-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(organizations): move organization better-auth client to conditionally be included based on FF #2367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ally be included based on FF
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryFixed client-server misalignment where Changes:
Impact:
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client as Auth Client
participant FF as Feature Flag (isBillingEnabled)
participant Server as Auth Server
participant OrgPlugin as Organization Plugin
Note over Client,OrgPlugin: Before PR (Misaligned)
Client->>Client: Always includes organizationClient()
Client->>Server: Request organization data
Server->>FF: Check isBillingEnabled
alt Billing Disabled
Server-->>Client: 404 Not Found
Note over Client: organizationClient() enabled<br/>but server plugin disabled
end
Note over Client,OrgPlugin: After PR (Aligned)
Client->>FF: Check isBillingEnabled
alt Billing Enabled
Client->>Client: Include organizationClient()
Client->>Server: Request organization data
Server->>OrgPlugin: Process request
OrgPlugin-->>Server: Return organization
Server-->>Client: Success
else Billing Disabled
Client->>Client: Exclude organizationClient()
Client->>Client: useActiveOrganization returns stub
Note over Client: No server request,<br/>no 404 error
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
apps/sim/lib/auth/auth-client.ts, line 45 (link)logic:
useActiveOrganizationexported here will beundefinedwhen billing is disabled (sinceorganizationClient()won't be included in plugins). Accessingclient.useActiveOrganizationin team-usage.tsx:19 may cause runtime errors.Consider adding a conditional export or wrapping usage in checks:
1 file reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, no comments
Summary
auth.tsand enabled all the time on the client, it always checked for an org and got a 404 back every time, but now they are alignedType of Change
Testing
Tested manually
Checklist