fix(credentials): add cross-cache invalidation for oauth credential queries#4076
Conversation
PR SummaryLow Risk Overview Updates all credential-set mutations to use Reviewed by Cursor Bugbot for commit ca32a83. Configure here. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds cross-cache invalidation so that workspace credential mutations (create, update, delete) also invalidate The Confidence Score: 5/5Safe to merge — changes are additive cache invalidations and non-breaking lifecycle handler migrations. All findings are P2 or below. The OAUTH_CREDENTIALS_KEY constant correctly mirrors oauthCredentialKeys.all, onSettled signatures are correct for all 8 mutations in credential-sets.ts, and the three new cross-cache invalidations are logically correct for credential CRUD operations. No logic errors, data loss, or security concerns found. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/sim/hooks/queries/credentials.ts | Adds OAUTH_CREDENTIALS_KEY constant and cross-cache invalidation to useCreateWorkspaceCredential, useUpdateWorkspaceCredential, and useDeleteWorkspaceCredential; key value correctly matches oauthCredentialKeys.all. |
| apps/sim/hooks/queries/credential-sets.ts | Switches 8 credential-set mutation handlers from onSuccess to onSettled for reliable cache reconciliation; parameter signatures correctly updated to include _error. |
Sequence Diagram
sequenceDiagram
participant UI as Credential UI
participant Mutation as useCreate/Update/DeleteWorkspaceCredential
participant QC as QueryClient
participant WC as workspaceCredential queries
participant OC as oauthCredentials queries
UI->>Mutation: mutate(payload)
Mutation->>API: POST/PUT/DELETE /api/credentials
API-->>Mutation: response
Note over Mutation: onSettled (success or error)
Mutation->>QC: invalidateQueries(workspaceCredentialKeys.lists())
QC->>WC: refetch
Mutation->>QC: invalidateQueries(['oauthCredentials'])
QC->>OC: refetch
OC-->>UI: credential-selector dropdowns update
Reviews (1): Last reviewed commit: "fix(credentials): add cross-cache invali..." | Re-trigger Greptile
Summary
oauthCredentialKeysso credential-selector dropdowns update immediatelyonSuccesstoonSettledfor reliable cache reconciliationType of Change
Testing
Tested manually
Checklist