perf(csv-import): paginate sets preview and fix N+1 vote queries#29
Open
perf(csv-import): paginate sets preview and fix N+1 vote queries#29
Conversation
- 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
setMatcherwere replaced with a single batchedINquery instead of one request per matched set.Generated by Claude Code