Skip to content

fix: server-side search and role filter for org users so results beyond the first page are found - #9893

Open
nishantmonu51 wants to merge 3 commits into
mainfrom
nishant/org-users-server-side-search
Open

nishantmonu51 wants to merge 3 commits into
mainfrom
nishant/org-users-server-side-search

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator
  • 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 (debounced, ILIKE-escaped substring match) and role params via getOrgUserMembersQueryOptions.
  • Invitations have no server-side filter, so loadNextInvitePageForFilter keeps loading invite pages until exhausted whenever a filter is active.
  • The table stays mounted while a new search loads: previous member rows are kept as placeholder data (never across organizations) and InfiniteScrollTable shows 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.
  • InfiniteScrollTable re-observes the sentinel after each page loads so client-side filtering that hides an entire page still triggers the next load.
  • Adds unit tests for the query options, invite page loading, and the table loading states.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

…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";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

@nishantmonu51 nishantmonu51 added Type:Bug Something isn't working Size:L Large change: 500-1,999 lines Team:Applications Applications Working Group labels Sep 16, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size:L Large change: 500-1,999 lines Team:Applications Applications Working Group Type:Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants