Repository navigation
Description
Summary
The release-readiness review (.claude/reports/RELEASE_READINESS.md §1.3, Appendix A — local, gitignored) found the results list unvirtualized: every revealed row is a live DOM subtree, and the only bound is the hard ceiling of MAX_REVEAL = 1,000 rows — which the list auto-pages toward on scroll. At the ceiling that is 1,000 mounted card subtrees, each with EventFacts/EventChips and their hooks. The existing mitigations are real but not a fix: EventListItem is the repo's only React.memo (EventListItem.tsx:123) and reveals run inside useTransition. This ticket adds windowed rendering — or, as the honest documented fallback, lowers MAX_REVEAL.
Scope flag, stated up front: this is the largest of the perf tickets. The list lives inside a vaul drawer whose scroll container the virtualizer must measure against; if the virtualizer fights vaul's scroll container, the sanctioned fallback is a lower MAX_REVEAL plus a written decision in the implementation report — not a half-working virtualizer.
Current behavior
MAX_REVEAL = PAGE_SIZE * 40= 1,000 (src/lib/shape/reveal.ts:38,59);revealRowsslices the sorted set to it (reveal.ts:180). All revealed rows render as real DOM.- Auto-paging: an IntersectionObserver in
LoadMore(src/components/organisms/EventsList/LoadMore.tsx:92-101) advances the reveal as the control scrolls into view — armed only whilemore === 'more' && !showAll; the distant segment is always an explicit press. - Mitigations in place:
EventListItemmemoized (src/components/molecules/EventListItem/EventListItem.tsx:123), reveal advances inuseTransition,aria-busy(neverdisabled) on the control plus a polite live region (LoadMore.tsx, covered byLoadMore.test.tsx).
Proposed changes
Windowed rendering for the results list (EventsList / DynamicEventsList):
- Evaluate
@tanstack/react-virtual— small, headless, fits the existing DOM structure (ul > lirows inside the drawer's scroll container) — vs. simply loweringMAX_REVEALas the documented fallback decision. The implementer owns this call; record it either way. - Standard virtualizer hygiene: overscan, and focus handling so the focused row is never unmounted under the user.
MUST preserve, whichever path is taken:
- Reveal/position-restore semantics:
useRevealis store-keyed byrevealKeyso the paging position survives drawer remounts (open an event, come back, still deep in the list) and resets by construction on a new search/filter/sort key — see.claude/rules/i18n-and-state.md§useResultsReveal. Virtualization changes what's mounted, not what's revealed; don't collapse the two. - The LoadMore boundary behavior: auto-page within the nearby segment; reaching the distant segment is always an explicit "Show distant events" press; the label keeps saying "distant" for every page after it.
aria-busysemantics and the polite live region (keyboard users keep focus on the control;LoadMore.test.tsxcovers this — keep it green).- Hover prefetch + pin-highlight handlers per row (
activate/highlightEventon the card). - Keyboard focus across virtualization: the focused row must not be unmounted under the user (overscan/focus-retention), and the
data-event-rowfocus move onto the first newly revealed card after a reveal press must still work.
Acceptance criteria
- With the list revealed to a large count (e.g. ≥ 500 rows), the mounted DOM row count is bounded by viewport + overscan, not by the reveal count — or the fallback decision (lower
MAX_REVEAL) is taken and documented with reasoning in the implementation report. - Position restore preserved: open an event from deep in the list, navigate back, the list is still revealed to the same depth (store-keyed by
revealKey; no reset call added to filters/sort — the reset stays by-construction). - Auto-page + explicit-press boundary preserved: nearby segment auto-pages via the observer; the distant segment requires the explicit press; labels unchanged.
-
aria-busy+ live-region semantics preserved; existingLoadMore.test.tsxpasses unmodified or with edits justified in the report. - Hover prefetch and pin-highlight still fire for every visible row.
- Keyboard: a focused row is never unmounted while focused; post-reveal focus move (
data-event-row) still lands on the first new card. - If a new dependency is added, it's justified in the report (size, maintenance) and
pnpm-lock.yamlis regenerated viapnpm install. -
pnpm lint && pnpm typecheck && pnpm test:runpass. - Write an implementation report to
.claude/reports/<issue-number>-virtualize-list.md— in the MAIN checkout at/Users/devindra/Documents/Projects/SahajAtlasWebeven when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved.
Files affected
src/components/organisms/EventsList/—EventsList.tsx,DynamicEventsList.tsx,LoadMore.tsx(+ co-located stories/tests)src/lib/shape/reveal.tspnpm-lock.yaml— shared file; conflicts with sibling tickets are resolved by re-runningpnpm install
Parallel implementation: this ticket OWNS the files above; sibling release-hardening tickets run concurrently. Avoid edits outside owned files except strictly additive ones. Note EventListItem.tsx is cited as evidence but is owned by the sibling caching/prefetch ticket — its handlers must keep working from this list, but edits to it belong there.
References
.claude/reports/RELEASE_READINESS.md§1.3, §1.6 (recommendation 5), Appendix A (local, gitignored)- Reveal semantics:
.claude/rules/i18n-and-state.md§useResultsReveal(why paging position survives drawer remounts, why reset is by-construction) src/lib/shape/reveal.ts:38,59,180(PAGE_SIZE,MAX_REVEAL, the slice);LoadMore.tsx:92-101(observer);EventListItem.tsx:123(the repo's oneReact.memo)
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity