Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(client): address requested changes
Elian Doranb0a3d5427654
diff --git a/apps/client/src/services/attributes.ts b/apps/client/src/services/attributes.tsindex 0ead073567..77558c9464 100644--- a/apps/client/src/services/attributes.ts+++ b/apps/client/src/services/attributes.ts@@ -190,7 +190,7 @@ async function toggleDangerousAttribute(note: FNote, type: "label" | "relation",for (const attr of attrs) {const baseName = getNameWithoutDangerousPrefix(attr.name);const newName = willEnable ? baseName : `disabled:${baseName}`;- if (newName === attr.name) return;+ if (newName === attr.name) continue;// We are adding and removing afterwards to avoid a flicker (because for a moment there would be no active content attribute anymore) because the operations are done in sequence and not atomically.if (attr.type === "label") {diff --git a/apps/client/src/widgets/layout/ActiveContentBadges.tsx b/apps/client/src/widgets/layout/ActiveContentBadges.tsxindex 0ffad6c1fe..3049e46243 100644--- a/apps/client/src/widgets/layout/ActiveContentBadges.tsx+++ b/apps/client/src/widgets/layout/ActiveContentBadges.tsx@@ -203,14 +203,10 @@ function ActiveContentToggle({ note, info }: { note: FNote, info: ActiveContentIswitchOffTooltip={t("active_content_badges.toggle_tooltip_disable_tooltip", { type: title })}switchOnTooltip={t("active_content_badges.toggle_tooltip_enable_tooltip", { type: title })}onChange={async (willEnable) => {- const attrs = note.getOwnedAttributes()- .filter(attr => {- if (attr.isInheritable) return false;- const baseName = attributes.getNameWithoutDangerousPrefix(attr.name);- return DANGEROUS_ATTRIBUTES.some(item => item.name === baseName && item.type === attr.type);- });-- await Promise.all(attrs.map(a => attributes.toggleDangerousAttribute(note, a.type, a.name, willEnable)));+ await Promise.all(note.getOwnedAttributes()+ .map(attr => ({ name: attributes.getNameWithoutDangerousPrefix(attr.name), type: attr.type }))+ .filter(({ name, type }) => DANGEROUS_ATTRIBUTES.some(item => item.name === name && item.type === type))+ .map(({ name, type }) => attributes.toggleDangerousAttribute(note, type, name, willEnable)));}}/>;}