From 20b301ac0eb02ccda163a190f73cbd6f6306c21a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 13 Nov 2025 10:59:56 +0200 Subject: [PATCH] fix(collections/list): archived notes not shown on first render --- apps/client/src/widgets/react/hooks.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index f6c14d45a..0ee92f8af 100644 --- a/apps/client/src/widgets/react/hooks.tsx +++ b/apps/client/src/widgets/react/hooks.tsx @@ -406,14 +406,17 @@ export function useNoteLabelWithDefault(note: FNote | undefined | null, labelNam } export function useNoteLabelBoolean(note: FNote | undefined | null, labelName: FilterLabelsByType): [ boolean, (newValue: boolean) => void] { - const [ labelValue, setLabelValue ] = useState(!!note?.hasLabel(labelName)); + const [, forceRender] = useState({}); - useEffect(() => setLabelValue(!!note?.hasLabel(labelName)), [ note ]); + useEffect(() => { + forceRender({}); + }, [ note ]); useTriliumEvent("entitiesReloaded", ({ loadResults }) => { for (const attr of loadResults.getAttributeRows()) { if (attr.type === "label" && attr.name === labelName && attributes.isAffecting(attr, note)) { - setLabelValue(!attr.isDeleted); + forceRender({}); + break; } } }); @@ -430,6 +433,7 @@ export function useNoteLabelBoolean(note: FNote | undefined | null, labelName: F useDebugValue(labelName); + const labelValue = !!note?.hasLabel(labelName); return [ labelValue, setter ] as const; }