fix(table_of_contents): not showing on first render of read-only notes

This commit is contained in:
Elian Doran 2025-12-26 13:28:29 +02:00
parent 6d80323a76
commit c23fe7cf13
No known key found for this signature in database

View File

@ -1177,7 +1177,7 @@ export function useContentElement(noteContext: NoteContext | null | undefined) {
const requestId = ++requestIdRef.current;
noteContext?.getContentElement().then(contentElement => {
// Prevent stale async.
if (requestId !== requestIdRef.current) return;
if (!contentElement || requestId !== requestIdRef.current) return;
setContentElement(contentElement?.[0] ?? null);
forceUpdate(v => v + 1);
});