Skip to content

feat: search tablets via backend on the database page#3838

Merged
astandrik merged 5 commits intomainfrom
copilot/switch-tablet-search-backend-handler
Apr 27, 2026
Merged

feat: search tablets via backend on the database page#3838
astandrik merged 5 commits intomainfrom
copilot/switch-tablet-search-backend-handler

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

The tablet search on the database Diagnostics → Tablets tab was filtering only the locally loaded tablets (direct children of the database path), so users could not find tablets that belong to sub-objects. Route the search through /viewer/tabletinfo with a TabletId filter so any tablet of the database is reachable.

Changes (src/containers/Tablets/Tablets.tsx)

  • Scope the new behavior: only active when path === databaseFullPath (database diagnostics tab). Schema-object pages and the Node page keep their current client-side search.
  • Backend filter: when the debounced search is a numeric tablet id, send (TabletId=<id>) and drop the schema path so the handler searches the whole database. Combined with onlyActive via the existing (A;B) syntax already used on the tablet page.
  • Debounce: 1s on the URL-backed tabletsSearch param before issuing the request (the call can be heavy).
  • Input guard: non-numeric input never hits the backend (regex /^\d+$/), which also avoids filter-syntax injection.
const isDatabasePage = path === databaseFullPath;
const useBackendSearch = isDatabasePage && /^\d+$/.test(debouncedSearch);

if (useBackendSearch) {
    // Search across the entire database, not just the database root path.
    params = {database, filter: `(TabletId=${debouncedSearch})`};
}

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
634 630 0 1 3

😟 No changes in tests. 😕

Bundle Size: 🔺

Current: 63.46 MB | Main: 63.46 MB
Diff: +8.08 KB (0.01%)

⚠️ Bundle size increased. Please review.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

Copilot AI linked an issue Apr 24, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Switch tablet search to backend handler Search tablets via backend on the database page Apr 24, 2026
Copilot AI requested a review from adameat April 24, 2026 12:02
@adameat
Copy link
Copy Markdown
Member

adameat commented Apr 27, 2026

@copilot it works, but there is a small issue. when I search for a tablet (I paste the tablet id into search box), at first it switches to an empty table with title "no tablets data", and only after a delay it calls backend and shows a tablet. looks confusing

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot it works, but there is a small issue. when I search for a tablet (I paste the tablet id into search box), at first it switches to an empty table with title "no tablets data", ...

Fixed in 2241f34. While the debounce is in flight on the database page (numeric input), the table now shows a loading state instead of being immediately filtered client-side to empty, and the client-side TabletId.includes(search) filter is bypassed in backend-search mode so the existing list isn't filtered against a not-yet-loaded id.

@adameat adameat marked this pull request as ready for review April 27, 2026 04:36
Copilot AI review requested due to automatic review settings April 27, 2026 04:36
@adameat
Copy link
Copy Markdown
Member

adameat commented Apr 27, 2026

Comment thread src/containers/Tablets/TabletsTable.tsx Outdated
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot use https://github.com/conventional-changelog/commitlint/#what-is-commitlint to name the PR properly

I don't have permission to edit the PR title from here. Suggested conventional-commit title (matches the repo's commitlint config — lowercase subject, ≤72 chars):

feat: search tablets via backend on the database page

Could you rename the PR to that? The merge commit message will then satisfy commitlint.

Copilot AI requested a review from adameat April 27, 2026 04:41
@adameat adameat changed the title Search tablets via backend on the database page feat: search tablets via backend on the database page Apr 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Routes the Diagnostics → Tablets tab search on the database page through the backend so users can find tablets that belong to sub-objects (not only the currently loaded direct children).

Changes:

  • Adds URL-param-backed, debounced numeric TabletId search that switches the tablets request to a database-wide backend filter (and omits schema path) on the database diagnostics page.
  • Combines backend TabletId filtering with the existing onlyActive filter using the viewer filter syntax.
  • Updates the tablets table to optionally skip client-side filtering when backend search is active/pending.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/containers/Tablets/Tablets.tsx Implements debounced backend search (numeric TabletId only) for the database diagnostics tablets tab and adjusts request params/filter construction accordingly.
src/containers/Tablets/TabletsTable.tsx Adds useBackendSearch prop to disable local filtering when results are already filtered server-side.

Comment thread src/containers/Tablets/TabletsTable.tsx
@adameat
Copy link
Copy Markdown
Member

adameat commented Apr 27, 2026

@copilot address the comments

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 27, 2026

@copilot address the comments

Addressed both review comments in 2573683:

  • Renamed useBackendSearchbackendSearchActive (prop and local var) so identifiers don't start with use and trip react-hooks/rules-of-hooks heuristics.
  • When backend search is active, skip tablets.filter(...) entirely — pass tablets through and use a single short-circuit loop just to compute showEndOfRange, avoiding an unnecessary array allocation on large lists.

Copilot AI requested a review from adameat April 27, 2026 04:49
@astandrik astandrik added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit 3a71810 Apr 27, 2026
20 checks passed
@astandrik astandrik deleted the copilot/switch-tablet-search-backend-handler branch April 27, 2026 11:26
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.

switch tablet search to backend handler

4 participants