← All ideas

Docs: Server-render block content so the editor does not shift on load

NewDocsFix

DocsBlockEditor.tsx:97-107 writes el.innerHTML = block.content in a useLayoutEffect, so the server HTML has empty contentEditable blocks and the text only appears after hydration. Measured on a 60-block page with 4x CPU and 4G: LCP 1.85 s (other pages are around 0.9 s) and CLS 0.215. Five blocks grow from 34 to 90 px at about 2 s. The Docs tree that is portaled into #side-branch adds 0.048 more. Notion opens pages with their text already painted. First scope: render the first pass with dangerouslySetInnerHTML (keeping the anti-clobber effect for later changes) and reserve the height of #side-branch. Priority: high. Effort: S.

Comments 0

No comments yet.