Skip to content

improvement(tables): make Cmd+F search as you type and clear on close - #6733

Merged
waleedlatif1 merged 12 commits into
stagingfrom
feat/table-find-ux
Aug 15, 2026
Merged

improvement(tables): make Cmd+F search as you type and clear on close#6733
waleedlatif1 merged 12 commits into
stagingfrom
feat/table-find-ux

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Cmd+F in a table had two problems: nothing told you the search only ran on Enter, and closing the bar left the search behind. Reworked it to match what Chrome and Sheets do.

  • Searches as you type (debounced), so there is nothing to discover. Enter and Shift+Enter now step through matches instead of being the way to search at all.
  • Every match is highlighted, not just the one you're on — the active match keeps the selection outline, so you can see the hits and which one you're on at once. Uses the app's existing --highlight-match-bg token, the same one the knowledge-base search highlight paints with.
  • A counter that says which state you're in: hidden before you type, 3 of 12 once there are hits, a spinner while the next result set lands, No results only once the search has settled. It holds the previous count mid-typing rather than blanking, and reserves its width so the bar doesn't resize on the first keystroke.
  • Clears completely on close — term, highlights, and match cursor. It also puts you back on the cell you were on before opening find, unless you'd since selected one yourself. (Sheets parks you on the last match; that's a standing complaint there.)
  • Added a clear (X) button in the field, an accessible name on the input, and no spellcheck squiggle on search terms.

Also fixes a pre-existing bug found on the way: closing the bar left the previous term's matches cached as keepPreviousData, so reopening and pressing Enter on an empty box navigated the old search's hits.

Type of Change

  • Improvement

Testing

  • 11 unit tests on the find bar covering each counter state, Enter / Shift+Enter / Escape, the clear button, and the disabled-nav case. Verified they fail when the behavior is broken.
  • Typecheck, bun run lint:check, bun run check:audits (26 audits), and 1291 table tests pass.
  • Not yet clicked through in a browser.

Notes for review

Live search makes a few things newly hot; each is handled deliberately:

  • Auto-jump to the first match is skipped when that row isn't loaded yet. ensureRowsLoadedUpTo pages sequentially, so a selective term whose first hit is 50k rows down would otherwise fire ~50 serial round trips per typing pause. Highlights and the count still cover the whole table; only the viewport jump waits for a deliberate Enter/next-click.
  • Auto-reveal is keyed on the term, not the result-set identity — the find query hangs off the rows cache, so a row write or SSE update would otherwise yank you from match 7 back to match 1.
  • Matches are grouped into a per-row Map so rows without a hit keep a stable undefined prop and don't re-render; TableFind is memoized.
  • gcTime added to the find query, since each typing pause now mints its own cache entry.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 15, 2026 11:52pm

Request Review

@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Large interaction-state changes in the main table grid (debounce, placeholder data, paging, selection) could cause edge-case navigation bugs, but there is no change to auth, persistence APIs, or data writes beyond existing find/row fetch behavior.

Overview
Reworks table Cmd+F so the search runs on a debounced trimmed query (not only on Enter), with immediate clear when the bar closes or the query is emptied so stale keepPreviousData matches cannot replay under a fresh box.

The find bar now treats Enter / Shift+Enter as match navigation when results match the submitted term; while the typed term is stale or still loading, Enter commits or does nothing instead of stepping through the previous term’s hits. The counter stays mounted with stable width, shows 1 of N (or N+ when truncated), keeps the prior count while loading, and shows a spinner until No results is definitive.

All matching cells get a --highlight-match-bg overlay (active hit still reads via the selection outline). Matches are grouped per row for memoized DataRow updates. Auto-reveal of the first hit runs once per term and is skipped if that row isn’t in the loaded window (avoids serial paging on every typing pause); next/prev and deliberate navigation still use the existing paging path with sequence guards against superseded jumps.

TableFind is memoized; find query cache gcTime is shortened for type-as-you-go. Unit tests cover the bar’s counter and keyboard behavior. Closing find clears term, highlights, and cursor but does not restore the pre-find cell selection (last match / current selection remains, per inline design).

Reviewed by Cursor Bugbot for commit 4b884db. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes table find search debounced as users type, highlights all matches, improves counter and navigation states, and clears search state when closed.

  • Adds match highlighting and a memoized find bar with clear, loading, count, and accessible input states.
  • Coordinates debounced queries, placeholder-result gating, match identity reconciliation, and deferred row loading.
  • Adds focused find-bar interaction tests and shortens find-query cache retention.

Confidence Score: 4/5

The PR is not yet safe to merge because a match removed during the final deferred-reveal window can still be selected as a current result.

The reply states that the removed-match issue was fixed, but the current code validates the target only before queueing it; a row invalidation can remove it before the later effect selects it without another membership check.

Files Needing Attention: apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx Implements live-search state, navigation, highlighting data, and cursor reconciliation, but deferred reveal still has a post-validation race when its target disappears.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-find.tsx Adds accessible live-search controls, stale-result navigation gating, loading/count states, and clear behavior.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/data-row.tsx Renders per-cell find-match overlays while preserving selection and pinned-cell layering.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-find.test.tsx Covers the find bar's counter, keyboard, clear, and disabled-navigation behavior.
apps/sim/hooks/queries/tables.ts Retains prior results between term keys and reduces garbage-collection time for live-search cache entries.

Comments Outside Diff (1)

  1. apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-grid/table-grid.tsx, line 1300-1302 (link)

    P1 Deferred reveal accepts removed match

    When a same-term row update removes the target after goToMatch validates it but before this deferred effect runs, the effect selects the now-nonmatching cell and marks the cursor as on a result, causing the next navigation to skip the replacement match.

    Knowledge Base Used: User Tables (apps/sim/lib/table)

Reviews (12): Last reviewed commit: "fix(tables): skip the reveal when the ta..." | Re-trigger Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 b5b2a88. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 a4a71ac. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Fixed the remaining in-flight-jump issue in 0153cd4: a dedicated effect keyed on the submitted term now bumps the jump sequence, nulls the pending match and drops isJumping on every term change — declared above the auto-reveal so it runs first. A jump still paging toward the previous term's match can no longer finish, pass its own sequence check and reveal a cell that no longer matches. Clearing and closing route through the same effect, since both drive the term to empty.

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 95f578d. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 7599a53. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 62a2297. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 4b884db. Configure here.

@waleedlatif1
waleedlatif1 merged commit 611df8b into staging Aug 15, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/table-find-ux branch August 15, 2026 23:57
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.

1 participant