From c23fe7cf132429834ec38050600ef973b4919e34 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 26 Dec 2025 13:28:29 +0200 Subject: [PATCH] fix(table_of_contents): not showing on first render of read-only notes --- apps/client/src/widgets/react/hooks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index e3e750c4a..215742046 100644 --- a/apps/client/src/widgets/react/hooks.tsx +++ b/apps/client/src/widgets/react/hooks.tsx @@ -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); });