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
fix(collections/list): archived notes not shown on first render
Elian Doran20b301ac0eb0
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsxindex f6c14d45a4..0ee92f8af0 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>): [ boolean, (newValue: boolean) => void] {- const [ labelValue, setLabelValue ] = useState<boolean>(!!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: FuseDebugValue(labelName);+ const labelValue = !!note?.hasLabel(labelName);return [ labelValue, setter ] as const;}