Skip to content

perf(note-list): virtualize with react-virtuoso#795

Open
CodyTseng wants to merge 1 commit into
masterfrom
perf/virtualize-note-list
Open

perf(note-list): virtualize with react-virtuoso#795
CodyTseng wants to merge 1 commit into
masterfrom
perf/virtualize-note-list

Conversation

@CodyTseng

Copy link
Copy Markdown
Owner

Summary

  • Replace render-all-items + IntersectionObserver pagination in NoteList with react-virtuoso.
  • Introduce ScrollAreaProvider so the list picks the right scroll mode: useWindowScroll on mobile (preserves the browser-chrome auto-hide behavior) vs customScrollParent on desktop (uses the existing Radix ScrollArea viewport).
  • Tune Virtuoso with overscan=1000, increaseViewportBy=1000, and skipAnimationFrameInResizeObserver — keeps scroll-position compensation synchronous with size changes, eliminating the back-scroll jitter from variable-height items loading async (matches the config YakiHonne uses).
  • Drop the IntersectionObserver-based reveal logic in EmbeddedNote; virtualization handles offscreen items now.

Test plan

  • Mobile: window scroll still hides browser chrome; pull-to-refresh works.
  • Desktop: scrolling inside PrimaryPageLayout / SecondaryPageLayout is smooth.
  • Initial load shows skeleton, then notes; reaching the bottom triggers pagination.
  • Pinned notes appear above regular notes.
  • scrollToTop & refresh imperative APIs still work.
  • Switching primary pages no longer lags with thousands of notes loaded.
  • Scrolling back up does not jitter.

🤖 Generated with Claude Code

Replace the render-all-items + IntersectionScroll pagination with
react-virtuoso. Add ScrollAreaProvider so NoteList can pick the right
scroll mode: useWindowScroll on mobile (preserves browser-chrome auto-
hide) vs customScrollParent on desktop (uses the existing Radix
ScrollArea viewport).

Tune Virtuoso with overscan=1000, increaseViewportBy=1000, and
skipAnimationFrameInResizeObserver so scroll-position compensation
happens in the same frame as the size change — eliminates the
back-scroll jitter caused by variable-height items loading async
(same config YakiHonne uses).

Also drops the IntersectionObserver-based reveal logic from
EmbeddedNote; virtualization handles offscreen items now.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant