Skip to content

fix(data-grid): fix ranged pasting - #1136

Merged
sadmann7 merged 1 commit into
mainfrom
sadman/fix-paste-behavior
Jun 14, 2026
Merged

sadmann7 merged 1 commit into
mainfrom
sadman/fix-paste-behavior

Conversation

@sadmann7

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 14, 2026 10:52
@vercel

vercel Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
tablecn Ready Ready Preview, Comment Jun 14, 2026 10:53am

@sadmann7 sadmann7 changed the title fix(data-grid): fix range pasting fix(data-grid): fix ranged pasting Jun 14, 2026
@sadmann7
sadmann7 merged commit d4f9bfd into main Jun 14, 2026
8 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Comment thread src/lib/data-grid.ts
}

const lines = text.split("\n");
const lines = text.split("\n").map((l) => l.replace(/\r$/, ""));

This branch was successfully deployed

2 active deployments
Production — d4f9bfd6 Deployed Jun 14, 2026 by vercel[bot]
Preview — d4f9bfd6 Deployed Jun 14, 2026 by vercel[bot]
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