From daff5f2c09bfe5f3fc12a75347e5983f20a6be85 Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Tue, 8 Aug 2023 15:53:47 -0700 Subject: [PATCH] feat: add warning toast if the api returns no comments --- src/lib/components/lemmy/comment/Comments.svelte | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/components/lemmy/comment/Comments.svelte b/src/lib/components/lemmy/comment/Comments.svelte index 8286de99..140cae74 100644 --- a/src/lib/components/lemmy/comment/Comments.svelte +++ b/src/lib/components/lemmy/comment/Comments.svelte @@ -69,9 +69,21 @@ if (treeParent) { // < 0.18.3 parent.children = treeParent.children + if (treeParent.children.length == 0) { + toast({ + content: 'The API returned no comments.', + type: 'warning', + }) + } } else { // 0.18.3+ parent.children = tree + if (tree.length == 0) { + toast({ + content: 'The API returned no comments.', + type: 'warning', + }) + } } } catch (error) { console.error(error)