diff --git a/apps/mobile/app/utils/note-bundle.js b/apps/mobile/app/utils/note-bundle.js index 1c3582db8..a8fbaa37a 100644 --- a/apps/mobile/app/utils/note-bundle.js +++ b/apps/mobile/app/utils/note-bundle.js @@ -84,16 +84,18 @@ async function createNotes(bundle) { if (bundle.tags) { for (const tagId of bundle.tags) { - await db.relations.add( - { - type: "tag", - id: tagId - }, - { - id: id, - type: "note" - } - ); + if (await db.tags.exists(tagId)) { + await db.relations.add( + { + type: "tag", + id: tagId + }, + { + id: id, + type: "note" + } + ); + } } } const compress = bundle.compress; diff --git a/apps/mobile/share/add-tags.jsx b/apps/mobile/share/add-tags.jsx index 84f4bc695..655a04d26 100644 --- a/apps/mobile/share/add-tags.jsx +++ b/apps/mobile/share/add-tags.jsx @@ -27,7 +27,6 @@ import { defaultBorderRadius } from "../app/utils/size"; export const AddTags = ({ onPress }) => { const { colors } = useThemeColors(); const tagIds = useShareStore((state) => state.selectedTags); - return ( { }} onPress={() => { const index = tagIds.indexOf(tagId); - const selectedTags = [...tagId]; + const selectedTags = tagIds.slice(); selectedTags.splice(index, 1); useShareStore.getState().setSelectedTags(selectedTags); }}