A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: Fix error when merging empty tags
MohamedBassem0b02f94215d6
diff --git a/packages/trpc/routers/tags.ts b/packages/trpc/routers/tags.tsindex 4806079a..b95570ae 100644--- a/packages/trpc/routers/tags.ts+++ b/packages/trpc/routers/tags.ts@@ -252,15 +252,17 @@ export const tagsAppRouter = router({.returning();// Re-attach them to the new tag- await trx- .insert(tagsOnBookmarks)- .values(- unlinked.map((u) => ({- ...u,- tagId: input.intoTagId,- })),- )- .onConflictDoNothing();+ if (unlinked.length > 0) {+ await trx+ .insert(tagsOnBookmarks)+ .values(+ unlinked.map((u) => ({+ ...u,+ tagId: input.intoTagId,+ })),+ )+ .onConflictDoNothing()+ }// Delete the old tagsconst deletedTags = await trx