mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-02 04:01:43 +02:00
web: restore the scroll position before the editor is painted
This commit is contained in:
@@ -691,7 +691,10 @@ function TiptapWrapper(
|
||||
theme.scopes.base.primary.paragraph;
|
||||
}, [theme]);
|
||||
|
||||
useEffect(() => {
|
||||
// Runs before the browser paints: `onLoad` restores the scroll position, and
|
||||
// doing that in a passive effect paints the note at the top for a frame
|
||||
// before it jumps to where the reader left off.
|
||||
useLayoutEffect(() => {
|
||||
if (!isHydrating) {
|
||||
onLoad?.();
|
||||
containerRef.current
|
||||
|
||||
Reference in New Issue
Block a user