Repository navigation
refactor(web): run auth and account mutations through mutation options - #47128
Conversation
Move forgot-password, email-code login, password login, change-email, account deletion, workspace rename and ownership transfer requests from imperative consoleClient calls to useMutation with generated consoleQuery mutation options, so shared mutation policies apply to them.
Vinext bundle analysisJS gzip: 🟠 +10.86 KiB (+0.10%) · CSS gzip: 🟠 +27 B (+<0.01%)
Entry changes: 🟠 196 increased · 🟢 5 decreased (gzip). Largest entry changesTop 5 by absolute gzip delta. Static dependencies overlap; do not sum entries.
Top 20 of 201 changed entries (full paths and raw sizes)
📦 1 package attribution changes (uncompressed modules)Showing 1 of 1, ordered by absolute module-size delta.
Measurement details and build revisionsBase: Raw JS change: 🟠 +77.14 KiB (+0.23%) · Raw CSS change: 🟠 +153 B (+<0.01%) 🟠 Increase · 🟢 Decrease · ⚪ Unchanged. Colors indicate direction, not a performance budget verdict. Percentages use the base size. Entries follow only static edges in the official Rolldown chunk graph, deduplicating shared files. Dynamic entries are measured when loaded; they are not page first-load metrics. Entry totals overlap and must not be summed. Download base/merge snapshots and official Rolldown analysis reports. Comparison: event base SHA vs the tested merge commit at GITHUB_SHA (PR or merge queue). |
There was a problem hiding this comment.
Codex review (gpt-6.1-sol, high) on 922d20c:
Closing either workspace dialog during an in-flight mutation now drops its completion handlers. A targeted MutationObserver reproduction confirmed that per-call callbacks are skipped after unsubscribe while hook-level callbacks still run.
Review comment:
- [P2] Preserve completion handlers after workspace dialogs unmount — web/app/components/header/account-setting/members-page/transfer-ownership-content/index.tsx:114-119
If the user closes the dialog while the transfer request is pending,DialogContentunmounts and React Query skips these per-callmutatecallbacks. The transfer still completes, but the reload is lost, leaving cached ownership and member state stale; failures also become invisible because the request is silent.EditWorkspaceContentintroduces the same regression for workspace renaming. Keep outcome handlers in hook-level mutation options or retain the awaitedmutateAsyncflow so they survive dismissal. This respects the overlay lifetime contract required by web/AGENTS.md:23.
Move the rename and ownership-transfer success/error handlers into the hook-level mutation options so they still run when the dialog unmounts while the request is in flight.
Summary
Auth and account write flows now call
useMutation(consoleQuery.X.mutationOptions())instead of callingconsoleClient.X.post/patch/put/deletedirectly, so shared mutation policies apply to them.isPending. Where it also covers follow-up work (profile reset, redirect), the local flag stays.useConfirmDeleteAccount/useDeleteAccountFeedbackare removed. The components use the generated mutation options directly.None of these endpoints has a policy yet, and none refreshed the cache at the call site, so no cache behaviour changes.
Stays imperative:
install/installForm.tsx: setup and login run inside one mutation with a single pending/success state.signin/invite-settings/page.tsx: relies onsafe()typing of defined errors, and its pending state spans the locale/profile reset and redirect.Imperative calls in these files: 22 → 3.
Checklist
consoleClientnow also mockconsoleQuery. Specs that assert silent requests buildconsoleQueryfrom the mocked client, so the requests go through the real mutation path. Unit and browser specs underapp/(auth), the web app reset password page,app/accountand the members page pass. Type-check and lint are clean.