fix(api,ui-react): public keys search across all pages#6384
Conversation
The React UI was already sending a base64-encoded `filter` query parameter on `/api/sshkeys/public-keys`, but the handler only bound `Paginator` and silently dropped it. As a result client-side `.filter()` on each 10-row page only matched keys already visible. Embed `query.Filters` in the request, define `PublicKeyFilterFields` restricting the filter to `contains`/`eq`/`ne` on `name` and `fingerprint`, and wire `Options().Match` into the store call.
|
Claude finished @luizhf42's task in 1m 3s —— View job Code Review CompleteReviewed 6 files across code quality, security, testing, Go/TypeScript patterns, and architecture — 1 issue found. Bug: onboarding empty state shown on zero-result search
The guard Fix — add - if (!isLoading && publicKeys.length === 0) {
+ if (!isLoading && publicKeys.length === 0 && !debouncedSearch) {If you've addressed the feedback and want a new review, tag |
Forward the search input to the new `filter` query parameter on the public keys list endpoint with a 300ms debounce, and drop the client-side `.filter()` block that only matched keys on the current page. Searching now surfaces matches across all server pages, and the pager footer reflects the filtered total.
501da4d to
9c25060
Compare
FIxed. Added |
|
/review |
|
Claude finished @gustavosbarreto's task in 5m 52s —— View job Code Review CompleteReviewed 6 files across code quality, security, testing, Go/TypeScript patterns, and architecture — no issues found. The implementation cleanly follows established patterns:
If you push additional changes and want a new review, tag |
What
The public keys search box now finds matches across all server pages instead of only the page currently in view.
Why
The React UI was already sending a
filterquery parameter onGET /api/sshkeys/public-keys(the same shape/devicesuses), but the API handler bound onlyPaginatorand silently dropped the filter. The page then ran a client-side.filter()over the 10 rows the server returned, so searches for a name or fingerprint living on page 2+ returned nothing.Changes
ListPublicKeysrequest now embedsquery.Filters; the handler runsUnmarshal+ValidateFiltersagainst a newPublicKeyFilterFieldsregistry that restricts the filter tocontains/eq/neonnameandfingerprint; the service appendsOptions().Matchto the store call. The generic storeMatchalready supports this without per-entity wiring, and the existing service test was updated to expect the thirdQueryOption.usePublicKeysaccepts asearchparam and forwardsbuildPublicKeyFilter(search)to thefilterquery param. The page debounces the input (300ms), drops the old client-side.filter()block, and resets to page 1 in the SearchFieldonChangehandler so a new search always starts from the first page of results.Testing