Repository navigation
fix(data-grid): fix ranged pasting - #1136
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses issues with data-grid paste behavior, particularly for ranged pasting scenarios, by normalizing parsed TSV input and improving how paste operations apply updates across selected cells and newly added rows.
Changes:
- Normalize TSV parsing to handle CRLF line endings more reliably when using the unquoted/tab-counting parser path.
- Enhance paste behavior to support “single-cell clipboard → fill selection” when multiple cells are selected.
- Adjust data update application to better handle updates that target rows added during paste row-expansion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/lib/data-grid.ts | Normalizes line parsing for TSV to avoid stray \r characters with CRLF input. |
| src/hooks/use-data-grid.ts | Updates paste handling (range fill) and data update application to better cover newly added rows and selection-based pasting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+410
to
+414
| const maxUpdateIndex = | ||
| rowUpdatesMap.size > 0 | ||
| ? Math.max(...Array.from(rowUpdatesMap.keys())) | ||
| : -1; | ||
| const dataLength = Math.max(currentData.length, maxUpdateIndex + 1); |
| const options = cellOpts?.options ?? []; | ||
| if (!pastedValue) { | ||
| processedValue = ""; | ||
| processedValue = null; |
Comment on lines
+736
to
+740
| // When clipboard has exactly one cell and the user has multiple cells | ||
| // selected, fill the entire selection with that single value. | ||
| const selectionCells = currentState.selectionState.selectedCells; | ||
| const isSingleCellClipboard = | ||
| rawPastedData.length === 1 && (rawPastedData[0]?.length ?? 0) === 1; |
| } | ||
|
|
||
| const lines = text.split("\n"); | ||
| const lines = text.split("\n").map((l) => l.replace(/\r$/, "")); |
This branch was successfully deployed
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.
No description provided.