fix(datagrid): scope Copy as transforms to selected cells (#1929)#1930
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
💡 Codex Review
When the cell selection contains only the primary-key column, generateUpdates intentionally returns an empty string, but this call still invokes writeText. NSPasteboardClipboardProvider.writeText clears the system pasteboard before writing, so using Copy as UPDATE in this valid selection erases whatever the user had copied previously instead of leaving the clipboard unchanged. Guard the generated SQL for emptiness before writing it.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
What
Fixes #1929. When you select specific cells in the data grid, Copy as INSERT, UPDATE, JSON, CSV, and Markdown now include only the selected columns. Before, they included every column of the affected rows.
Selecting
val_2.candval_2.d, then Copy as INSERT:Why
Plain Copy already reads the cell selection correctly. The "Copy as..." transforms collapsed the selection to row indices and rebuilt the column list from all visible columns, so which columns you selected was thrown away. This matches DataGrip's model (one selection-scoped extractor for every format) and the macOS HIG rule that a transformed Copy acts on the same selection as a plain Copy.
How
selectedColumnProjection()resolves the selected columns (union, display order, hidden columns excluded) when a cell selection exists, and falls back to all visible columns for a whole-row or empty selection. INSERT, JSON, CSV, and Markdown route through it.settableColumnsset onSQLRowToStatementConverterthat narrows the SET clause while the full row still feeds the WHERE. So SET narrows to the selected columns, WHERE keys on the primary key even when the primary key cell is not selected, a table with no primary key keeps identifying the row by its full contents, and a selection of only the primary key emits no statement instead of invalid SQL.Rows / With Headers (raw TSV) and IN Clause are unchanged: plain Copy already serves cell-precise TSV, and IN Clause is already single-column.
Tests
Docs / Changelog
[Unreleased].