fix: server-side search and role filter for org users so results beyond the first page are found - #9893
fix: server-side search and role filter for org users so results beyond the first page are found#9893nishantmonu51 wants to merge 3 commits into
Conversation
…first page are found The org users and guests pages filtered members client-side, so a search or role filter only matched the 50 rows already loaded. Members are now queried with the API's `searchPattern` and `role` params (debounced, ILIKE-escaped), while invitations, which have no server filter, keep loading pages until exhausted whenever a filter is active. The table stays mounted while a new search loads: previous rows are kept as placeholder data and `InfiniteScrollTable` shows a footer spinner instead of the empty state. The spinner only appears for the initial load, placeholder data, or next-page fetches, not for background refetches.
| @@ -0,0 +1,113 @@ | |||
| import { InfiniteQueryObserver, QueryClient } from "@tanstack/query-core"; | |||
There was a problem hiding this comment.
These tests should be E2E IMO. We are testing scroll behaviour along with query behaviour. So testing on mock data feels off. Same thing applies to selectors test. Infinite scroll table tests are fine since they are testing the component without too much mock data.
How about creating users like admin+1@rilldata.com (change admin to match the exact e2e user id), add some variants with searchable text after the + and run through the use cases in an E2E.
There was a problem hiding this comment.
Added web-admin/tests/org-users.spec.ts, which invites more than a page of plus-addressed variants of the e2e admin account and covers search beyond the first page, the pending invites filter loading every page, and search combined with the role filter. Verified locally: it fails against the parent commit and passes on this branch.
Dropped pagination.spec.ts since the e2e covers it. Only pending invites can be created in the e2e environment, so the server-side member search escaping and the cross-organization placeholder guard stay in selectors.spec.ts.
Invites more than one page of plus-addressed variants of the e2e admin account and checks that search finds an invite beyond the first page, that the pending invites filter loads every page, and that search combines with the role filter and the empty state.
searchPattern(debounced, ILIKE-escaped substring match) androleparams viagetOrgUserMembersQueryOptions.loadNextInvitePageForFilterkeeps loading invite pages until exhausted whenever a filter is active.InfiniteScrollTableshows a footer spinner instead of the empty state. The spinner covers the initial load, placeholder data, and next-page fetches only, not background refetches after mutations or refocus.InfiniteScrollTablere-observes the sentinel after each page loads so client-side filtering that hides an entire page still triggers the next load.Checklist: