Repository navigation
feat(grid): filter a column by clipboard value (= clipboard, IN clipb… - #1112
Conversation
ab7b599 to
1f4bf48
Compare
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Re-reviewed at HEAD Checked against current code:
Not run: tests, lint and typecheck (read-only review). Files Reviewed (16 files)
Previous Review Summaries (8 snapshots, latest commit da7e115)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit da7e115)Status: No Issues Found | Recommendation: Merge Re-reviewed at HEAD Checked against current code:
Not run: tests, lint and typecheck (read-only review). Files Reviewed (14 files)
Previous review (commit 0f1d16c)Status: No Issues Found | Recommendation: Merge Re-reviewed at HEAD Checked against current code:
Not run: tests, lint and typecheck (read-only review). Files Reviewed (14 files)
Previous review (commit b462bb0)Status: No Issues Found | Recommendation: Merge The PR is now a single commit rebased onto the repo-wide Prettier reformat ( Checked against current code:
Files Reviewed (14 files)
Previous review (commit 5bd7652)Status: No Issues Found | Recommendation: Merge The previous CRITICAL finding (stale base reverting undo/redo and "copy column names as SQL list") is resolved: the PR is now a single commit rebased directly onto current Checked against current code:
Files Reviewed (14 files)
Previous review (commit 1661976)Status: 1 Issue Found | Recommendation: Address before merge The earlier warning (misleading "Clipboard is empty" toast for non-numeric clipboard content) is resolved: both the However, the latest commit ( Overview
Issue Details (click to expand)CRITICAL
Files Reviewed (14 files)
Fix these issues in Kilo Cloud Previous review (commit 32f33dd)Status: No Issues Found | Recommendation: Merge The previous warning (misleading "Clipboard is empty" toast for non-numeric clipboard content) is resolved: both the "= clipboard" and "IN clipboard" paths now show the new Files Reviewed (12 files)
Previous review (commit ef113db)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (14 files)
Fix these issues in Kilo Cloud Previous review (commit 1f4bf48)Status: No Issues Found | Recommendation: Merge Files Reviewed (15 files)
Reviewed by claude-sonnet-5.5 · Input: 258 · Output: 2.9K · Cached: 355.2K Review guidance: REVIEW.md from base branch |
|
Reproducible test report Environment
Test Commands & Results
Pre-existing Failures
Notes for Reviewer
|
debba
left a comment
There was a problem hiding this comment.
Thanks for building this, filtering by a list pasted from somewhere else is a really practical addition. I like that the clipboard is read when the item is clicked rather than when the menu opens, that blank lines and duplicates are dropped, and that the 1000-value cap comes with a toast instead of silently cutting the list. Reusing formatSqlValueForColumnComparison for each IN item also keeps quoting and the PostgreSQL real cast consistent with the existing = filter. The tests and typecheck pass on the branch (cellValueFilter, DataGrid, i18n: 247 tests).
There's one problem I'd like fixed before merging, because it gives wrong results without any warning.
Non-numeric clipboard lines on a numeric column. A very common way to fill the clipboard is copying a column from a spreadsheet, header included. With the clipboard set to:
user_id
1
2
IN (clipboard) on an int column builds `user_id` IN ('user_id', 1, 2) (I checked it through parseClipboardInList + buildCellValueFilterClause with the mysql driver). Then:
- MySQL casts
'user_id'to0, so the filter also returns every row whereuser_id = 0, with only a1292 Truncated incorrect DOUBLE valuewarning that the user never sees. - PostgreSQL rejects the whole query:
ERROR: invalid input syntax for type integer: "id"(same clause shape run against a local PG table).
The same applies to = clipboard when the clipboard holds non-numeric text.
A fix that keeps the feature friendly: when the column is numeric (isNumericColumnType), drop the lines that aren't numbers and show a short toast with how many were skipped, and if nothing numeric is left, show the existing "no filter applied" message. A test with a header line in the clipboard would lock it in.
One coordination note, not something you need to change now: #1081 (still open, waiting for a rebase) moves the "Filter by this value" entries into a submenu and extends CellValueFilterOperator and CELL_VALUE_FILTER_LABEL_KEYS, so the two PRs conflict. Whichever lands second will need to rebase, and ideally these two clipboard entries would live in that submenu too.
Since this is your first PR here: if you feel like it, come say hi on our Discord, we'd be happy to have you around: https://discord.com/invite/K2hmhfHRSt
| isNumericColumnType(colDataType) && | ||
| !isNumericClipboardValue(clipboardText) | ||
| ) { | ||
| showToast(t("dataGrid.filterClipboardEmpty"), { |
There was a problem hiding this comment.
WARNING: Misleading toast when the clipboard value is non-numeric
This branch runs when the clipboard is not empty but its value isn't numeric for a numeric column (e.g. a copied spreadsheet header). It reuses dataGrid.filterClipboardEmpty ("Clipboard is empty — no filter applied"), so the user is told the clipboard is empty when it actually contains text. The same happens on the IN path (line 3187) when every line is dropped as non-numeric: nonNumericDropped > 0 but values.length === 0 shows "Clipboard is empty" and returns before the filterClipboardNonNumericDropped toast. Use a dedicated message (e.g. reuse/adapt filterClipboardNonNumericDropped, or add a new key) for the non-numeric case so the feedback matches the cause.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
|
@debba Thanks for the review! I've pushed the requested changes:
I also addressed the Kilo review note: when the clipboard held text but none of it was numeric, the code reused the "clipboard is empty" message, which was misleading. It now uses a dedicated Local checks: Happy to rebase once #1081 lands to avoid the conflict noted in the other comment. |
debba
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround, and for going one step further than I asked. Dropping the header line in parseClipboardInList and reporting how many lines were skipped is exactly what I had in mind. Splitting "clipboard is empty" from "clipboard has no numeric values" makes the feedback much clearer, and the header and duplicate-header tests lock the behaviour in nicely. I checked the branch locally: 255 tests pass across cellValueFilter, DataGrid and i18n, tsc -b is clean, eslint is clean, and the new keys are in all 11 locales.
The fix itself is good. The only thing stopping the merge is that #1081 landed on main on the 15th, so the branch now conflicts in DataGrid.tsx, cellValueFilter.ts and every locale file. Could you rebase onto main? Since you'll be in there anyway:
CellValueFilterOperatornow also has>,>=,<,<=andcontains, soINneeds to be added next to them, and also toCELL_VALUE_FILTER_LABEL_KEYS.- The "Filter by this value" entries now live in a submenu. I'd like the two clipboard entries to go in there too, so the context menu stays short.
Two small things you can pick up during the rebase if you like, they're not blocking:
filterClipboardNonNumericDroppeduses "value(s)". We already use i18next_one/_otherplurals elsewhere (databaseCount_onefor example), so it would read better that way.isNumericColumnTypeis a substring match on keywords likeint, so a PostgreSQLintervalcolumn counts as numeric. With this change,IN (clipboard)on that column drops every line and says there are no numeric values. It's an old helper and a rare case, so a follow-up is fine.
Once it's rebased I'll take another look and try it in the app before merging.
32f33dd to
1661976
Compare
| activeCapabilities ?? | ||
| activeDriver; | ||
| // Dialect the copied SQL literals follow (copy as INSERT / IN list). | ||
| const copyDriver = activeCapabilities ?? activeDriver; |
There was a problem hiding this comment.
CRITICAL: PR reverts two already-merged features (stale base)
The single commit in this PR is based on an older tree and, in DataGrid.tsx and all 11 locale files, deletes code that exists on current main (0524ac9a) and is unrelated to clipboard filtering:
- Undo/redo of pending grid edits (feat(editor): undo and redo pending grid edits (#1167) #1206): the
onUndo/onRedo/canUndo/canRedo/onBeginBatchEdit/onEndBatchEditprops, the Ctrl/Cmd+Z / Ctrl+Y handler, the batching indeleteRowsByIndicesandstageCellWrites, and theundo/redo/undoGridEdit/redoGridEditi18n keys. - Copy column names as SQL list (feat(grid): copy column names as quoted SQL list (#1153) #1185): the
copyColumnNamesAsSqlListaction, its menu item, theformatColumnNamesAsSqlListimport and thecopyColumnNamesSqlListi18n key. - This line also drops the per-connection
getConnectionData(connectionId)dialect resolution, so copied SQL literals / IN lists fall back to the globally active connection's dialect instead of the grid's own connection.
src/pages/Editor.tsx still passes onUndo={handleUndoGrid} and onBeginBatchEdit={handleBeginBatchEdit} (and objectNameCopy.ts still exports the formatter), so merging would silently disable these features with no test coverage noticing. Please rebase onto current main and resolve conflicts so the diff contains only the clipboard-filter changes.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
1661976 to
5bd7652
Compare
|
Hi @debba, thanks for the thorough review! Rebased onto the latest main and addressed all blocking points:
Verified locally: typecheck, eslint and the full suite (6752 tests) pass. |
There was a problem hiding this comment.
Thanks for sticking with this one. Putting both clipboard entries in the "Filter by this value" submenu keeps the context menu nice and short, and adding IN to CELL_VALUE_FILTER_BADGES and CELL_VALUE_FILTER_LABEL_KEYS keeps the operator maps exhaustive with the new >/</contains operators from #1081. I checked the branch locally: 323 tests pass across cellValueFilter, DataGrid and the i18n suite, and tsc -b and eslint on the changed files are clean.
I'm approving this. Before it can go in I need one more rebase, and I'm sorry about that: #1247 reformatted the whole codebase with Prettier right after your rebase, so DataGrid.tsx, cellValueFilter.ts and the test file conflict again. The conflicts are formatting only (4-space indent, single quotes, the @/types/plugins import). After resolving them please run pnpm format, because pnpm lint now also runs prettier --check.
While you're in there, one small i18n fix: the Russian filterClipboardNonNumericDropped only has _one and _other, but Russian needs _one, _few, _many and _other (see connectionCount_few in ru.json). As it is, 2 to 20 skipped values fall back to the English text, and 21 shows "Пропущено 1 ..." because _one hardcodes the 1 instead of using {{count}}.
A couple of things that are fine as follow-ups, nothing to do in this PR:
- Like
interval, geometry types (POINT,LINESTRING) contain "int", soisNumericColumnTypetreats them as numeric and both clipboard entries would say there are no numeric values.isComparableColumnTypealready guards against this withisGeometricType, so the clipboard path could reuse the same check. - On a MySQL
FLOATcolumn the clipboard values arrive as strings, so they skip theMath.froundwidening thatformatSqlValueForColumnComparisonapplies to numbers, andIN (clipboard)with something like1.1probably won't match the stored value.
Once it's rebased I'll try it in the app on MySQL and PostgreSQL before merging.
5bd7652 to
b462bb0
Compare
|
Thanks @debba, both done and force-pushed. Rebased onto the latest Russian pluralization fixed.
Verified locally (Node v22.23.2, pnpm 10.30.3):
I've left the two follow-ups for separate PRs as you suggested, not in this one: geometry types ( Ready for another look. |
b462bb0 to
0f1d16c
Compare
debba
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround on the last round. The Russian plurals now have all four forms with {{count}} in _one, which is exactly what I was after, and the rebase on top of the Prettier reformat was clean. I checked the branch again: 334 tests pass across cellValueFilter, DataGrid and the i18n suite, and pnpm build and eslint are clean.
I can't merge it yet though, and I'm sorry, because this time it's main that moved under you. The whole frontend now lives in packages/web-ui/ (src, tests and locales), so the same React app can run both in the desktop app and in the new tabularis web server. GitHub reports the branch as conflicting because of the move. Git's rename detection carries most of your changes across, but there's one real overlap: on main, DataGrid.tsx no longer imports readText from @tauri-apps/plugin-clipboard-manager. Clipboard access goes through the platform adapter now, and eslint.config.js blocks direct @tauri-apps/** imports in the web UI. I tried a throwaway merge and pnpm build fails with Cannot find name 'readText' on both clipboard entries (DataGrid.tsx:3392 and :3446 on your branch).
So when you rebase, please:
- move your changes to
packages/web-ui/src/...andpackages/web-ui/tests/utils/cellValueFilter.test.ts - replace
readText()in the two clipboard actions withplatform.readClipboard().platformfromusePlatformCapabilities()is already inDataGrid, andpasteFromClipboarddoes the same thing. As a bonus the feature then works in the browser version too: if the user denies clipboard permission it throws, and your existing "Could not read the clipboard" toast handles it. - keep only the new keys in the locale files. The last push also reformatted unrelated blocks in all 11 of them (
environment.short, the wholethemePackagessection,"triggers":{), about 100 lines each. Locales are in.prettierignore, so I think an editor JSON formatter did it. Leaving those blocks alone keeps the diff readable and avoids conflicts with other PRs that touch them.
One small thing while you're in there: there's no test yet for buildCellValueFilterClause with IN. A few cases would be nice, for example a numeric column, a string with a quote like O'Brien, and one that passes a capabilities object instead of a driver id (.rules/plugins.md asks for that last one). It would also help to add a line to the PR description saying plugin drivers get the feature through activeCapabilities.
Something I found while testing, not for this PR: formatSqlValueForFilter only doubles single quotes, so on MySQL a clipboard line ending with a backslash, like C:\temp\, ends up as 'C:\temp\' and breaks the query. That helper is older than your change, so it's not on you, but clipboard text makes it easier to hit and I wanted you to know. The geometry and FLOAT follow-ups from last time are still fine to leave for later.
Once it's rebased I'll try it in the app on MySQL and PostgreSQL before merging.
0f1d16c to
da7e115
Compare
|
Rebased onto main with the packages/web-ui/ layout. Everything from your last review is in:
Verified on the rebased branch: cellValueFilter 56/56, DataGrid + i18n suites 369/369, tsc -b clean, eslint clean on the changed files. Noted on the MySQL trailing-backslash escaping in formatSqlValueForFilter — agreed it is out of scope here; happy to file a separate issue for it. |
There was a problem hiding this comment.
Thanks for handling the frontend move and the clipboard adapter change. Both actions now call platform.readClipboard(), and the added IN cases cover quoted text and a capabilities object. I reran the filter, DataGrid and i18n suites on this head: 425 tests pass.
I haven't found a blocking issue. One nit for a follow-up: Prettier still reports DataGrid.tsx and cellValueFilter.test.ts. Please format those two files without reformatting the locale files.
Approved. I'm leaving this unmerged until my manual clipboard checks on MySQL and PostgreSQL, including denied browser permission and the transposed layout.
I have now done the manual Web app checks with the integrated frontend, the Tabularis 0.31.0 server container, PostgreSQL 16 and MySQL 8.4. Through the real context menu, clipboard id\n1\n2\n2 produced IN (1, 2) and returned rows 1 and 2 on both databases. Filtering a name with O'Brien generated O''Brien and returned the matching row. In the transposed layout, a clipboard list of 1 and 3 returned those two records. The shared browser denied clipboard access; that path displayed Could not read the clipboard and kept all three rows and the empty filter. For the successful cases I used local Chromium with clipboard permissions granted, without replacing the platform adapter or database client.
The formatting nit is fixed. I merged main, reran 429 filter/grid/i18n tests, and corrected the two inherited sidebar keyboard handlers flagged by the React linter; the 119 sidebar tests and source ESLint pass. The integrated production build passes. I have finished the manual checks and will merge once the refreshed CI passes. Desktop was not exercised here.
Add "= clipboard" and "IN (clipboard)" entries to the cell context menu (dashboard)
Closes #1032
tabularis webbrowser build; a denied clipboard permission surfaces as the existing "Could not read the clipboard" toast