mobile: fix invalid tags linked to note from share menu

This commit is contained in:
Ammar Ahmed
2025-04-21 12:34:42 +05:00
parent 7760f5e898
commit fb21fef82f
2 changed files with 13 additions and 12 deletions

View File

@@ -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;

View File

@@ -27,7 +27,6 @@ import { defaultBorderRadius } from "../app/utils/size";
export const AddTags = ({ onPress }) => {
const { colors } = useThemeColors();
const tagIds = useShareStore((state) => state.selectedTags);
return (
<TouchableOpacity
onPress={onPress}
@@ -123,7 +122,7 @@ const TagItem = ({ tagId }) => {
}}
onPress={() => {
const index = tagIds.indexOf(tagId);
const selectedTags = [...tagId];
const selectedTags = tagIds.slice();
selectedTags.splice(index, 1);
useShareStore.getState().setSelectedTags(selectedTags);
}}