A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: Fix duplicate bookmarks in links with assets
MohamedBassem3d495cd16aff
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.tsindex edf196bb..d0ffc7d3 100644--- a/packages/trpc/routers/bookmarks.ts+++ b/packages/trpc/routers/bookmarks.ts@@ -601,7 +601,11 @@ export const bookmarksAppRouter = router({};}- if (row.bookmarkTags) {+ if (+ row.bookmarkTags &&+ // Duplicates may accur because of the join, so we need to make sure we're not adding the same tag twice+ !acc[bookmarkId].tags.some((t) => t.id == row.bookmarkTags!.id)+ ) {invariant(row.tagsOnBookmarks,"if bookmark tag is set, its many-to-many relation must also be set",