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

This commit is contained in:
Elian Doran 2025-12-24 17:41:44 +02:00
parent 30cc221eca
commit b5af513371
No known key found for this signature in database

View File

@ -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;
}