perf(apollo-vertex): scope group-member query to requested group ids - #1023
Conversation
|
Apollo Coded App preview deployments are ready.
|
Dependency License Review
License distribution
Excluded packages
|
📊 Coverage + size by packagePer-package bundle size on this PR (no JS/TS source changes detected under
"Coverage" is each package's own |
There was a problem hiding this comment.
Pull request overview
This PR improves apps/apollo-vertex group-membership checks by pushing the groupIds filter into the @tanstack/react-db live query (instead of fetching the full groupMembers collection and filtering client-side), reducing query load as the collection grows.
Changes:
- Added
.where()support and aninArray()filter operator to the local@tanstack/react-dbtype stub. - Updated
useIsGroupMemberto apply a server-sidegroupId IN (...)filter and simplified the client-side membership check to only compare the user email.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/apollo-vertex/types/optional-deps.d.ts | Extends the @tanstack/react-db ambient type stub with .where() and inArray() to support filtered live queries. |
| apps/apollo-vertex/registry/shell/use-is-group-member.ts | Applies a .where(inArray(...)) filter to only fetch members for the requested groups, then checks for the current user’s email in the returned rows. |
Storybook visual diff✅ No stories are affected by this PR's changes; nothing to compare. Logs Updated (PT): Aug 07, 2026, 01:13:56 AM |
eefbffa to
171db82
Compare
Both
useIsGroupMember(used byGroupMembershipGuard) anduseGroupMemberspreviously pulled the entiregroupMemberscollection and filtered client-side, which overloads the query as the collection grows. They now push the filter into the live query via.where():useIsGroupMemberusesinArray(members.groupId, groupIds)anduseGroupMembersuseseq(members.groupId, groupId), so only members of the requested group(s) are fetched. The@tanstack/react-dbtype stub inoptional-deps.d.tsgained a.where()method plus theeqandinArrayoperators to support this. This depends on the upstreamgroupMemberscollection translating the predicate into a server-side filtered fetch.👨 Generated with Kluijt Code