From b0a3d5427654a0d70cd91a0039a21a2dc2234678 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 15 Feb 2026 17:15:51 +0200 Subject: [PATCH] chore(client): address requested changes --- apps/client/src/services/attributes.ts | 2 +- .../src/widgets/layout/ActiveContentBadges.tsx | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/client/src/services/attributes.ts b/apps/client/src/services/attributes.ts index 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.tsx index 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: ActiveContentI switchOffTooltip={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))); }} />; }