From 55266c2fac5544be977c3c0295cad06269582983 Mon Sep 17 00:00:00 2001 From: Robert Goniszewski Date: Thu, 28 Dec 2023 15:19:21 +0100 Subject: [PATCH] fix: add Svelte's key value for '#each' blocks to ensure reactivity of nested components; fix import Signed-off-by: Robert Goniszewski --- src/lib/components/BookmarkCard/BookmarkCard.svelte | 2 +- .../components/BookmarkListItem/BookmarkListItem.svelte | 2 +- src/lib/components/BookmarksList/BookmarkList.svelte | 4 ++-- src/lib/components/CategoryTree/CategoryTree.svelte | 7 +++---- .../ShowBookmarkContent/ShowBookmarkContent.svelte | 2 +- src/routes/+layout.svelte | 2 +- src/routes/admin/+page.svelte | 2 +- src/routes/profile/+page.svelte | 2 +- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/lib/components/BookmarkCard/BookmarkCard.svelte b/src/lib/components/BookmarkCard/BookmarkCard.svelte index b4de293..2bf2c2d 100644 --- a/src/lib/components/BookmarkCard/BookmarkCard.svelte +++ b/src/lib/components/BookmarkCard/BookmarkCard.svelte @@ -266,7 +266,7 @@
# {#if bookmark.tags} - {#each bookmark.tags as tag} + {#each bookmark.tags as tag (tag.id)} {tag.name} {/each} {/if} diff --git a/src/lib/components/BookmarkListItem/BookmarkListItem.svelte b/src/lib/components/BookmarkListItem/BookmarkListItem.svelte index 37ed935..4d8d21e 100644 --- a/src/lib/components/BookmarkListItem/BookmarkListItem.svelte +++ b/src/lib/components/BookmarkListItem/BookmarkListItem.svelte @@ -139,7 +139,7 @@
# {#if bookmark.tags} - {#each bookmark.tags as tag} + {#each bookmark.tags as tag (tag.id)} 0} {#if $userSettingsStore.bookmarksView === 'grid'}
- {#each bookmarks as bookmark} + {#each bookmarks as bookmark (bookmark.id)} {/each}
{:else if $userSettingsStore.bookmarksView === 'list'}
- {#each bookmarks as bookmark} + {#each bookmarks as bookmark (bookmark.id)} {/each}
diff --git a/src/lib/components/CategoryTree/CategoryTree.svelte b/src/lib/components/CategoryTree/CategoryTree.svelte index 068a51c..8118c04 100644 --- a/src/lib/components/CategoryTree/CategoryTree.svelte +++ b/src/lib/components/CategoryTree/CategoryTree.svelte @@ -1,12 +1,11 @@ -{#each categories as category} +{#each categories as category (category.id)}
{#if !category.icon} @@ -23,7 +22,7 @@
{#if category.children} - {#each category.children as categoryChild} + {#each category.children as categoryChild (categoryChild.id)}
{#if !categoryChild.icon}
Tags
{#if $bookmark.tags?.length} - {#each $bookmark.tags as tag} + {#each $bookmark.tags as tag (tag.id)} {tag.name} {/each} {:else} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 48c524a..1505f61 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -155,7 +155,7 @@

Tags

- {#each $page.data.tags as tag} + {#each $page.data.tags as tag (tag.id)} {#if tag.bookmarks.length > 0} #{tag.name} - {#each data.adminData.users as user} + {#each data.adminData.users as user (user.id)} {user.id} {user.name} diff --git a/src/routes/profile/+page.svelte b/src/routes/profile/+page.svelte index 30fc7a1..a9fb9b2 100644 --- a/src/routes/profile/+page.svelte +++ b/src/routes/profile/+page.svelte @@ -82,7 +82,7 @@

Latest bookmarks

{#if $page.data.bookmarks.length > 0}
- {#each $page.data.bookmarks.slice(0, 3) as bookmark} + {#each $page.data.bookmarks.slice(0, 3) as bookmark (bookmark.id)}