diff --git a/src/store/index.ts b/src/store/index.ts index 3fe2be2..f0d5409 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1619,8 +1619,8 @@ export const syncSystemTagsAndRules = async () => { // --- Sync Bucket Tags --- for (const bucket of store.buckets) { const bucketTagName = `@${bucket.name}`; - const tagExists = tagDefinitions.find(t => t.name === bucketTagName); - if (!tagExists) { + const tagExistsExact = tagDefinitions.find(t => t.name.toLowerCase() === bucketTagName.toLowerCase()); + if (!tagExistsExact) { try { const record = await pb.collection(TAGS_COLLECTION).create({ user: currentUserId, @@ -1641,10 +1641,10 @@ export const syncSystemTagsAndRules = async () => { } catch (e) { console.error(`Failed to create bucket tag ${bucketTagName}`, e); } - } else if (!tagExists.isBucket) { + } else if (!tagExistsExact.isBucket) { try { - await pb.collection(TAGS_COLLECTION).update(tagExists.id, { isBucket: true }); - setStore("tagDefinitions", d => d.id === tagExists.id, { isBucket: true }); + await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isBucket: true }); + setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isBucket: true }); } catch (e) { console.error(`Failed to flag tag ${bucketTagName} as bucket`, e); } @@ -1678,8 +1678,8 @@ export const syncSystemTagsAndRules = async () => { if (!originalName) continue; const userName = `@${originalName}`; - const tagExists = tagDefinitions.find(t => t.name === userName); - if (!tagExists) { + const tagExistsExact = tagDefinitions.find(t => t.name.toLowerCase() === userName.toLowerCase()); + if (!tagExistsExact) { try { const record = await pb.collection(TAGS_COLLECTION).create({ user: currentUserId, @@ -1700,10 +1700,10 @@ export const syncSystemTagsAndRules = async () => { } catch (e) { // console.error(`Failed to create user tag ${userName}`, e); } - } else if (!tagExists.isUser) { + } else if (!tagExistsExact.isUser) { try { - await pb.collection(TAGS_COLLECTION).update(tagExists.id, { isUser: true }); - setStore("tagDefinitions", d => d.id === tagExists.id, { isUser: true }); + await pb.collection(TAGS_COLLECTION).update(tagExistsExact.id, { isUser: true }); + setStore("tagDefinitions", d => d.id === tagExistsExact.id, { isUser: true }); } catch (e) { console.error(`Failed to flag tag ${userName} as user`, e); } diff --git a/src/views/SettingsView.tsx b/src/views/SettingsView.tsx index 8090d1a..357e3fa 100644 --- a/src/views/SettingsView.tsx +++ b/src/views/SettingsView.tsx @@ -890,9 +890,9 @@ export const SettingsView: Component<{ setView?: (v: string) => void }> = (props
Manage your global tag definitions and values.
+Manage tag definitions and values.