fix(tables): fix bulk ops truncation for tables larger than one page#4532
fix(tables): fix bulk ops truncation for tables larger than one page#4532waleedlatif1 merged 20 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Updates bulk mutations to respect server batch limits by chunking Smaller UX/validation tweaks: string cells auto-render valid URLs as external links with favicons (adds Reviewed by Cursor Bugbot for commit 290b4bf. Configure here. |
Greptile SummaryThis PR fixes bulk-operation truncation on large tables (>1 page) by adding
Confidence Score: 3/5Not safe to merge as-is: the run-scope fix is incomplete and the header-checkbox 'run all rows' path remains truncated to the loaded page. The table-grid.tsx — Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant TableGrid
participant ensureAllRowsLoaded
participant ReactQueryCache
participant Server
User->>TableGrid: Bulk op (Delete/Clear/Copy/Cut) on row selection
TableGrid->>ensureAllRowsLoaded: await ensureAllRowsLoadedRef.current()
loop "until lastPage.rows.length < MAX_QUERY_LIMIT"
ensureAllRowsLoaded->>ReactQueryCache: getQueryData(queryKey)
ensureAllRowsLoaded->>Server: fetchNextPage()
Server-->>ReactQueryCache: page N rows
end
ensureAllRowsLoaded-->>TableGrid: all rows[]
TableGrid->>TableGrid: pushUndo(undoCells)
TableGrid->>Server: chunkBatchUpdates (3 concurrent chunks)
Server-->>TableGrid: success / error
|
|
@greptile |
|
@cursor review |
|
@cursor review |
|
@greptile |
|
@cursor review |
|
@greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a89ee35. Configure here.
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2ba4836. Configure here.
Bulk operations (column-header delete, select-all copy/cut/delete/run) were silently truncated to the first 1000 rows because handlers only iterated the loaded pages from useInfiniteQuery. Fix: - Extract tableRowsInfiniteOptions factory (infiniteQueryOptions) so the hook and imperative drain share the same typed cache key - Add background drain via useEffect watching hasNextPage/isFetchingNextPage — chains fetchNextPage until getNextPageParam returns undefined - Add ensureAllRowsLoaded to use-table: reads cache via getQueryData + calls fetchNextPage in a while loop until the last page is partial - Await ensureAllRowsLoaded at every kind:'all' bulk-op entry point in table-grid (column delete, copy, cut, action-bar delete/run) - Add chunkBatchUpdates to send updates in MAX_BULK_OPERATION_SIZE=1000 chunks so server validation never rejects oversized batches - Fix undo-redo: make executeAction async and chunk clear-cells, update-cells, and delete-column cell-restore with mutateAsync loops Tests: 41 passing across use-table, tables queries, and use-table-undo
…ipboard NotAllowedError
…error toast; column-cut drain
…entity - Fix polling tick: move Promise.all inside else-branch so dirty[] stays in scope; keep hasDirty=true during active mutations so the short interval fires while chunked batch-updates are in flight - Add isColumnSelectionRef branch to handleCopy (mirrors handleCut fix): column-header Cmd+C now drains all pages before building clipboard content - Replace String(updatedAt) comparison in mergePagePreservingIdentity with Date.getTime() equality — handles ISO vs +00:00 timezone variants - Remove redundant batchUpdates.length > 0 guards at chunkBatchUpdates callsites (empty-array case is handled inside the function) - Export _mergePagePreservingIdentity for unit testing - Add 6 unit tests covering mergePagePreservingIdentity edge cases
…ch updates - Drop the per-page polling loop — SSE stream already patches execution cell state in real time and invalidates on buffer prune; polling was redundant and burned CPU/network on every open table - Remove eager mount drain (fetchNextPage loop in use-table.ts); scroll handler and ensureAllRowsLoaded handle progressive/on-demand loading - Parallelize chunkBatchUpdates with a 3-worker pool instead of serial chunks, reducing bulk-op round-trips by ~3x - Delete mergePagePreservingIdentity and its tests (no longer called)
- Fix chunkBatchUpdates JSDoc to reflect parallel dispatch (was "sequentially") - Inline CHUNK_CONCURRENCY=3, single-use constant needs no abstraction - Drop stale "Polls while any cell is in flight" from useTableRows JSDoc - Remove two generic "Validation errors surfaced by caller" comments - Remove ASCII separator line from workflow group mutations section - Remove dead `if (!variables) return` guard in useImportCsvIntoTable onSettled (TanStack v5 always provides variables to onSettled)
…ded pages When rowSelection.kind === 'all', selectedRunScope now flags allRows: true. The action-bar run handlers pass rowIds: undefined to the server when allRows is set, matching the server contract (missing rowIds = run all eligible rows). Stop likewise routes through scope: 'all' instead of per-row cancels. Previously, selecting all rows and clicking Run would silently only run the rows loaded in the current infinite-query cache (potentially one page of 1000 on a 5000-row table).
…ss covers full undo execution
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 290b4bf. Configure here.
Summary
Type of Change
Testing
Tested manually — verified all rows clear/copy/cut/delete correctly on tables >1000 rows. All unit tests passing.
Checklist