Skip to content

refactor(web): run auth and account mutations through mutation options - #47128

Merged
hyoban merged 2 commits into
mainfrom
refactor/web-auth-account-mutation-options
Nov 25, 2026
Merged

hyoban merged 2 commits into
mainfrom
refactor/web-auth-account-mutation-options

Conversation

@hyoban

@hyoban hyoban commented Nov 25, 2026

Copy link
Copy Markdown
Member

Summary

Auth and account write flows now call useMutation(consoleQuery.X.mutationOptions()) instead of calling consoleClient.X.post/patch/put/delete directly, so shared mutation policies apply to them.

  • Reset password (console and web app), sign-in check code and resend, mail-and-code and mail-and-password sign-in, the email change modal, delete account (verify email and feedback), edit workspace, and transfer ownership.
  • Where a local loading flag covered only the request, it now reads the mutation's isPending. Where it also covers follow-up work (profile reset, redirect), the local flag stays.
  • Delete account: the forwarding hooks useConfirmDeleteAccount / useDeleteAccountFeedback are 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 on safe() typing of defined errors, and its pending state spans the locale/profile reset and redirect.

Imperative calls in these files: 22 → 3.

Checklist

  • I've verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • Specs that mocked consoleClient now also mock consoleQuery. Specs that assert silent requests build consoleQuery from the mocked client, so the requests go through the real mutation path. Unit and browser specs under app/(auth), the web app reset password page, app/account and the members page pass. Type-check and lint are clean.

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.
@github-actions github-actions Bot added web This relates to changes on the web. size:L This PR changes 100-499 lines, ignoring generated files. labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Vinext bundle analysis

JS gzip: 🟠 +10.86 KiB (+0.10%) · CSS gzip: 🟠 +27 B (+<0.01%)

All client output Base gzip → Merge gzip Gzip change
JS 10360.29 KiB → 10371.15 KiB 🟠 +10.86 KiB (+0.10%)
CSS 346.81 KiB → 346.84 KiB 🟠 +27 B (+<0.01%)

Entry changes: 🟠 196 increased · 🟢 5 decreased (gzip).

Largest entry changes

Top 5 by absolute gzip delta. Static dependencies overlap; do not sum entries.

Source entry Base gzip → Merge gzip Gzip change
client-reference: app/components/billing/evaluation-plan-guard.tsx 250.36 KiB → 338.34 KiB 🟠 +87.98 KiB (+35.14%)
client-reference: app/components/snippets/snippet-evaluation-page.tsx 709.08 KiB → 713.40 KiB 🟠 +4.33 KiB (+0.61%)
client-reference: app/(auth)/signin/check-code/page.tsx 283.47 KiB → 285.77 KiB 🟠 +2.30 KiB (+0.81%)
client-reference: app/(auth)/reset-password/set-password/page.tsx 270.31 KiB → 272.59 KiB 🟠 +2.28 KiB (+0.84%)
client-reference: app/(shareLayout)/webapp-reset-password/page.tsx 277.20 KiB → 279.47 KiB 🟠 +2.28 KiB (+0.82%)
Top 20 of 201 changed entries (full paths and raw sizes)
Source entry Base gzip → Merge gzip Gzip change Raw change
client-reference: app/components/billing/evaluation-plan-guard.tsx 250.36 KiB → 338.34 KiB 🟠 +87.98 KiB (+35.14%) 🟠 +231.19 KiB (+28.65%)
client-reference: app/components/snippets/snippet-evaluation-page.tsx 709.08 KiB → 713.40 KiB 🟠 +4.33 KiB (+0.61%) 🟠 +11.10 KiB (+0.50%)
client-reference: app/(auth)/signin/check-code/page.tsx 283.47 KiB → 285.77 KiB 🟠 +2.30 KiB (+0.81%) 🟠 +6.03 KiB (+0.68%)
client-reference: app/(auth)/reset-password/set-password/page.tsx 270.31 KiB → 272.59 KiB 🟠 +2.28 KiB (+0.84%) 🟠 +5.98 KiB (+0.70%)
client-reference: app/(shareLayout)/webapp-reset-password/page.tsx 277.20 KiB → 279.47 KiB 🟠 +2.28 KiB (+0.82%) 🟠 +5.99 KiB (+0.66%)
client-reference: app/(auth)/reset-password/check-code/page.tsx 266.07 KiB → 268.32 KiB 🟠 +2.25 KiB (+0.85%) 🟠 +5.97 KiB (+0.71%)
client-reference: app/(auth)/reset-password/page.tsx 266.50 KiB → 268.74 KiB 🟠 +2.24 KiB (+0.84%) 🟠 +5.94 KiB (+0.70%)
client-reference: app/components/datasets/create/index.tsx 624.79 KiB → 623.41 KiB 🟢 −1.38 KiB (−0.22%) 🟢 −2.96 KiB (−0.16%)
client-reference: app/components/datasets/documents/create-from-pipeline/index.tsx 848.91 KiB → 847.56 KiB 🟢 −1.35 KiB (−0.16%) 🟢 −2.87 KiB (−0.11%)
client-reference: features/agent-v2/agent-detail/page.tsx 1568.55 KiB → 1569.71 KiB 🟠 +1.16 KiB (+0.07%) 🟠 +1.36 KiB (+0.03%)
client-reference: app/components/evaluation/index.tsx 706.39 KiB → 707.50 KiB 🟠 +1.12 KiB (+0.16%) 🟠 +1.36 KiB (+0.06%)
dynamic-entry: app/components/workflow/nodes/agent-v2/panel.tsx 1609.69 KiB → 1610.05 KiB 🟠 +378 B (+0.02%) 🟠 +1.37 KiB (+0.03%)
client-reference: app/components/workflow-app/index.tsx 1466.19 KiB → 1466.51 KiB 🟠 +331 B (+0.02%) 🟠 +910 B (+0.02%)
dynamic-entry: app/components/header/account-setting/index.tsx 539.96 KiB → 540.25 KiB 🟠 +289 B (+0.05%) 🟠 +890 B (+0.05%)
dynamic-entry: app/components/workflow/workflow-generator/index.tsx 885.31 KiB → 885.56 KiB 🟠 +254 B (+0.03%) 🟠 +504 B (+0.02%)
dynamic-entry: app/components/workflow/nodes/agent/panel.tsx 1460.91 KiB → 1461.14 KiB 🟠 +231 B (+0.02%) 🟠 +653 B (+0.01%)
client-reference: app/(commonLayout)/datasets/(datasetDetailLayout)/[datasetId]/pipeline/page.tsx 1404.19 KiB → 1404.41 KiB 🟠 +230 B (+0.02%) 🟠 +638 B (+0.01%)
client-reference: app/components/app/configuration/index.tsx 1341.59 KiB → 1341.82 KiB 🟠 +227 B (+0.02%) 🟠 +573 B (+0.01%)
dynamic-entry: app/components/workflow/features.tsx 1388.16 KiB → 1388.38 KiB 🟠 +224 B (+0.02%) 🟠 +660 B (+0.01%)
dynamic-entry: app/components/rag-pipeline/components/panel/input-field/preview/index.tsx 1362.39 KiB → 1362.61 KiB 🟠 +223 B (+0.02%) 🟠 +598 B (+0.01%)
📦 1 package attribution changes (uncompressed modules)

Showing 1 of 1, ordered by absolute module-size delta.

Package Base Merge Δ
@orpc/tanstack-query 10.22 KiB 10.44 KiB 🟠 +226 B (+2.16%)
Measurement details and build revisions

Base: 55b4bd7d793e58d69accd82c166f9b197178be00 · Merge: 5955313c921c9dd6b6dd2f6e948947a8a17bea6a
Vinext: 1.4.5 → 1.4.5; Rolldown: 1.2.19 → 1.2.19

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.
Package attribution sums module sizes reported by Rolldown, not compressed emitted bytes. Gzip totals are measured per emitted file. This is Vinext output, not Next.js/Turbopack output.
Report only: increases do not fail this check. Missing or incompatible analysis data does.

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).

@hyoban hyoban left a comment •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, DialogContent unmounts and React Query skips these per-call mutate callbacks. 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. EditWorkspaceContent introduces the same regression for workspace renaming. Keep outcome handlers in hook-level mutation options or retain the awaited mutateAsync flow 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.
@hyoban
hyoban marked this pull request as ready for review November 25, 2026 11:25
@hyoban
hyoban added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 95ed8c4 Nov 25, 2026
49 checks passed
@hyoban
hyoban deleted the refactor/web-auth-account-mutation-options branch November 25, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants