Fix useDeferredValue getting stuck - #36134
Conversation
|
Comparing: ed69815...df5ef86 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
acdlite
left a comment
There was a problem hiding this comment.
Nice! Is it a good or a bad thing that there was already a TODO that (sorta) described the issue 😆
Discussed out-of-band, writing here for posterity:
The TODO I think is still correct, we should generalize that special-error-to-unwind-the-stack trick thing that we use for selective hydration. The main benefit is that if you're mid render it can restart immediately instead of burning cycles on a work-in-progress render that will inevitably get thrown out regardless. Leaving for a future PR in case we were to accidentally introduce a new bug in the progress.
Fixes #35821 Written/debugged by Claude. ## Test Plan - Verify undoing the source fix fails the newly added test - Verify building a bundle with the fix solves https://github.com/gaearon/react-udv-bug/ repro DiffTrain build for [c0d218f](c0d218f)
Fixes #35821 Written/debugged by Claude. ## Test Plan - Verify undoing the source fix fails the newly added test - Verify building a bundle with the fix solves https://github.com/gaearon/react-udv-bug/ repro DiffTrain build for [c0d218f](c0d218f)
Fixes react#35821 Written/debugged by Claude. ## Test Plan - Verify undoing the source fix fails the newly added test - Verify building a bundle with the fix solves https://github.com/gaearon/react-udv-bug/ repro DiffTrain build for [c0d218f](react@c0d218f)
Fixes react#35821 Written/debugged by Claude. ## Test Plan - Verify undoing the source fix fails the newly added test - Verify building a bundle with the fix solves https://github.com/gaearon/react-udv-bug/ repro DiffTrain build for [c0d218f](react@c0d218f)
- server.ts: viem-based USDC tipping on Base mainnet from EconomyOS-provisioned wallet - Claude reasoning step: agent decides tip amount or skip with one-line rationale - PagerDuty REST integration: fetch incidents, find linked PR, post note with tx hash - GitHub REST: PR author lookup - new endpoints: POST /demo/run · GET /api/agent · GET /api/fires - CORS so the frontend on :8765 can call the backend on :3001 - 03-my-watchers.html wired to the backend: live "Fire demo" button, real fire list, wallet balance stat - tip cap dropped to $0.03 USDC for cheap repeated demo runs Verified end-to-end: incident created → PR detected (react/react#36134, @gaearon) → Claude decided tip → on-chain tx 0x234771b5...3e26 on Base mainnet → note posted in PD.
…#1740) Next.js 16.3 changes `next/error`'s `ErrorInfo` shape twice over: `error` becomes `unknown` and `unstable_retry` is renamed to `retry`. All 34 `error.tsx` / `global-error.tsx` files imported `ErrorInfo` directly, so the bump would have had to touch every one of them in the same commit. Route them through `src/shared/lib/errors/error-boundary-props.ts` instead. `ErrorBoundaryProps` takes `error: unknown` with both retry props optional, so either version's `ErrorInfo` is assignable to it and Next's generated route type validation accepts the components on 16.2 and 16.3 alike. Upgrading then edits one file: make `retry` required and drop the fallback. Motivation: 16.3 carries the React fix for `useDeferredValue` getting stuck (react/react#36134), which is what leaves admin save buttons disabled on "保存中..." forever after a revalidating Server Action while the write itself succeeds (vercel/next.js#86055). Measured here on /admin/settings/features: Next 16.2.12 hangs 5/5, Next 16.3.0-preview.10 hangs 0/5. This commit deliberately does not bump `next` — 16.3.0 stable is unreleased. Co-authored-by: y2ikgm89 <y2ikgm89@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…pending hang (#1786) revalidate 付き Server Action の後にクライアントが RSC ペイロードを commit せず、 送信ボタンが pending のまま戻らない上流バグ(react/react#36134 / vercel/next.js#86055)の修正を取り込む。React core メンテナが 2026-07-03 に 「react#36134 で修正、16.3.0 で出る」と述べて issue を close しており、 **16.2.x への backport は無い**(v16.2.12 が 16.2 系の最終リリース)。 ## 本番の実害 admin がイベントを作成すると、実際は DB に作成できているのに「作成中...」の スピナーが戻らない。二重送信や再読込を誘発する。revalidate + redirect する admin mutation 全般が対象(スペース料金プラン更新でも同型を確認)。 ## 実測 production build で `events-create-online.spec.ts` を 10 回試行: | next | 失敗 | 所要時間 | | ------------------ | ------ | --------------- | | 16.2.12 | 2 / 10 | 2.8 〜 26.9 秒 | | 16.3.0-preview.10 | 0 / 10 | 2.6 〜 4.8 秒 | 失敗時もサーバーは 303 を 127〜170ms で返し切っており、クライアントが適用しない だけだった(POST 完了 → URL 反映は成功時 0.10〜0.26 秒 / 失敗時は 20 秒経っても 起きない二値)。 ## 広域 E2E の対照実験(#1783 適用後) | run | next | failed | flaky | passed | | ----------- | ------------------ | ------ | ----- | ------ | | 30686096541 | 16.2.12 | 1 | 1 | 325 | | 30686085976 | 16.3.0-preview.10 | 1 | 1 | 325 | 形が同一で回帰は見られない。hard failure は両方とも既存の `mypage-receipt-download`。flaky は互いに別 spec でどちらも初出のノイズ。 ## コスト **ソース変更ゼロ**。PR #1740 の `src/shared/lib/errors/error-boundary-props.ts` seam が 16.3 の `ErrorInfo` 破壊的変更を吸収済み。バンドルは -532 kB(-16.7%)。 stable ではなく preview を採る判断: 16.3.0 stable が未リリースである一方、 本番の実害が継続しているため。本番デプロイは workflow_dispatch のみなので merge しても自動では出ない。revert は package.json 1 行。 Co-authored-by: y2ikgm89 <y2ikgm89@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
`package.json` pins `next` to `16.3.0-preview.10`, but the dependency pin table listed only Bun / TypeScript / Zod / Lexical, so nothing in the repo said this is a pre-release or that it is meant to be temporary. PR #1786 documented the reasoning well — upstream React `useDeferredValue` stuck bug (react/react#36134 / vercel/next.js#86055) leaving Server Action submit buttons permanently pending in production, fixed only in 16.3.0 with no 16.2 backport — but a merged PR body is not somewhere anyone looks. Without a pointer in the pin table, "switch back when 16.3.0 stable ships" has no owner. Renovate may well raise the stable bump on its own; this is the note that explains, at review time, why the exact pin was pre-release to begin with. Test plan: - bun scripts/prettier.ts --check CLAUDE.md: exit 0 - Documentation only; no code paths touched. Co-authored-by: y2ikgm89 <y2ikgm89@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Root cause: a confirmed upstream React/Next.js 16 bug (vercel/next.js#86055, fixed by react/react#36134 in Next 16.3.0) leaves useTransition's isPending permanently stuck whenever a Server Action invoked inside startTransition also triggers a router revalidation (revalidatePath and/or router.refresh). The follow-up RSC fetch is silently reported net::ERR_ABORTED with no console error, so the client never applies the update - confirmed via live browser console capture showing the action resolving successfully while the DOM stayed frozen. Upgraded next 16.2.12 -> 16.3.0 to pick up the fix, and removed the now- redundant client-side router.refresh() in the upload form (revalidatePath already refreshes the route from the action's own response). This unblocked two previously-hidden, unrelated bugs that only had a chance to run for the first time once the upload step stopped cascading-failing every serial test after it: - runExtractionWorker() (and any other test helper that shells out via `dotenv -e .env.e2e`) never received the run-specific tmp/e2e-storage/prod-{runId} directory the spawned server actually wrote uploads to, only .env.e2e's static default - same bug class as the already-fixed TEST_MAILBOX_DIR. Fixed by threading LOCAL_STORAGE_PATH into the Playwright process env in run-e2e-prod.ts. - A strict-mode Playwright locator matched two stacked toast notifications in extraction-flow.spec.ts; fixed with .last(). Verified: extraction-flow.spec.ts, ai-conversation-flow.spec.ts, and clause-intelligence-flow.spec.ts (the three specs that failed 100% reproducibly in the Phase 12.5 Linux CI comparison) all now pass cleanly without any per-component changes beyond the framework upgrade. Full local suite passed 101/101 twice consecutively. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fixes #35821
Written/debugged by Claude.
Test Plan