Skip to content

perf(csv-import): paginate sets preview and fix N+1 vote queries#29

Open
chiptus wants to merge 5 commits intomainfrom
claude/fix-csv-import-freeze-xcDUY
Open

perf(csv-import): paginate sets preview and fix N+1 vote queries#29
chiptus wants to merge 5 commits intomainfrom
claude/fix-csv-import-freeze-xcDUY

Conversation

@chiptus
Copy link
Copy Markdown
Owner

@chiptus chiptus commented May 8, 2026

Fixes the page freeze when importing large CSVs (680+ sets).

Sets preview now renders 20 rows at a time with a per-page "Import" button that auto-advances on success. The vote-count queries in setMatcher were replaced with a single batched IN query instead of one request per matched set.


Generated by Claude Code

- SetsPreviewTable now renders one page of 20 rows at a time, eliminating
  the main-thread freeze when loading 680+ sets
- Each page has its own "Import page X of Y" button; on success the table
  auto-advances and marks the page green in the pagination strip
- The matching query (useMatchingSetsQuery) now runs only against the
  current page's sets instead of all 680 at once
- setMatcher: replaced N individual vote-count queries with a single
  batched IN query, eliminating the matching-phase freeze
- CSVImportPage: stages import remains a single button; sets import is
  fully handled page-by-page from within SetsPreviewTable via
  onImportPage callback

https://claude.ai/code/session_01DGRhbUy6VhzNfMqVD2eZ5q
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
upline Ready Ready Preview, Comment May 9, 2026 10:23am

Extract selection initialization into useSetSelections hook and
pagination/import controls into PageImportControls component.
SetsPreviewTable now stays under 150 lines.

https://claude.ai/code/session_01DGRhbUy6VhzNfMqVD2eZ5q
…verrides

useSetSelections now computes default artist/set selections as pure derived
values via useMemo, storing only user overrides in state. Eliminates both
useEffects and the eslint-disable-next-line comments they required.

https://claude.ai/code/session_01DGRhbUy6VhzNfMqVD2eZ5q
useArtistSelections(sets, artistsByName) handles artist name→id mapping
across all rows. useSetMatchSelections(pageSets, pageStart, matchingSetsData)
handles create/match/duplicate defaults for the current page. Removes the
combined hook that mixed two unrelated input shapes.

https://claude.ai/code/session_01DGRhbUy6VhzNfMqVD2eZ5q
Instead of one DB query per set row (case-sensitive, failing on no-match),
fetch all stages for the edition in one query before the import loop and
look up by lowercased name from a Map. Eliminates N stage queries and fixes
case-insensitive stage matching.

https://claude.ai/code/session_01DGRhbUy6VhzNfMqVD2eZ5q
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.

2 participants