Skip to content

Build your personal knowledge base with Trilium Notes

fix(breadcrumbs): not reacting to protected session being started

Elian Doranb5af51337147
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index bc5e7a8e77..9a688c10e1 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -1090,7 +1090,7 @@ export function useNoteTitle(noteId: string | undefined, parentNoteId: string |
const [ title, setTitle ] = useState<string>();
const requestIdRef = useRef(0);
- useEffect(() => {
+ const refresh = useCallback(() => {
const requestId = ++requestIdRef.current;
if (!noteId) return;
tree.getNoteTitle(noteId, parentNoteId).then(title => {
@@ -1099,6 +1099,15 @@ export function useNoteTitle(noteId: string | undefined, parentNoteId: string |
});
}, [ noteId, parentNoteId ]);
+ useEffect(() => {
+ refresh();
+ }, [ refresh ]);
+
+ // React to changes in protected session.
+ useTriliumEvent("protectedSessionStarted", () => {
+ refresh();
+ });
+
return title;
}