Conversation
Splits the mobile half of #2450 out to ship first: useOrgTeams reads the active-org store reactively and sends TeamFilter.organizationId, and stays idle while no org is known. Safe against today's backend — the teams read prefers the filter and falls back to the still-live X-Organization-ID header — so old and new binaries both work until the header retirement lands, once this build is deployed. The header interceptor keeps sending the header (removal is #2452); the backend retirement follows in #2450 after adoption. #2450 drops its FE hunks when rebasing onto this. Verified: tsc (lib + spec), eslint, prettier; vitest runs in CI.
Contributor
Reviewer's GuideThe PR moves teams organization scoping from implicit header reliance to the active organization ID in GraphQL filter variables, using a reactive store subscription and skipping unscoped requests. Tests validate remembered/current organization selection, request-time consistency, early loading behavior, and the no-active-organization case. Sequence diagram for organization-scoped teams queriessequenceDiagram
participant Store as ActiveOrgStore
participant Hook as useOrgTeams
participant Apollo as ApolloClient
participant Backend as TeamsAPI
Store->>Hook: subscribeActiveOrgId()
Store-->>Hook: getActiveOrgId()
Hook->>Apollo: useQuery(TeamsDocument, variables.filters.organizationId)
Apollo->>Backend: Teams request with organizationId
Backend-->>Apollo: Teams result
Apollo-->>Hook: teams, loading, error
alt no active organization
Hook->>Apollo: skip query
end
Flow diagram for active-organization teams query gatingflowchart TD
A[Active organization store changes] --> B[useSyncExternalStore reads activeOrgId]
B --> C{activeOrgId exists?}
C -->|Yes| D[useQuery with filters.organizationId]
D --> E[Teams API returns scoped teams]
C -->|No| F[Query skipped; remain idle]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
🚀 Expo continuous deployment is ready for betterangels!
iOS Simulator Build: Simulator Build Link |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mobile-first split of #2450 (
feat/perm/teams-header-strip) — see the rollout audit on #2457. Jira: DEV-2566.Why this lands first
The backend half of #2450 retires the
X-Organization-IDheader — any released app build that still reads as header-only would getYou do not have access to this organization.on the teams query the moment that deploys (and teams power the TaskForm picker). The app can't be redeployed instantly, so the client change ships first:What changes
useOrgTeamsreads the active-org store reactively (useSyncExternalStoreovergetActiveOrgId/subscribeActiveOrgId— the same store the header interceptor read) and sends it asTeamFilter.organizationId. The query is skipped while no org is active (none remembered, or the user has none) instead of issuing a request the backend would deny.Why it's safe against today's backend
TeamFilter.organizationIdalready exists on main (merged in feat(perm): teams fully grant-based & header-free — ORG_ADMIN + CASEWORKER role-backed, org in filter/payload (DEV-2559) #2443), and the teams read prefers the filter, falling back to the header — so:Rollout
runtimeVersion(or the next store build if the runtime moved).Notes
vitestruns in CI (the dev container ships only the darwin rolldown binding).tsc --noEmit(lib + spec),eslint,prettier.Summary by Sourcery
Scope team picker queries to the active organization and avoid unauthorized requests when no organization is selected.
New Features:
Enhancements:
Tests: