[v3] Maximum update depth exceeded opening a document from the list view with cacheComponents: true (dev): backport #18702's CloseModalOnRouteChange guard
メンテナーはふだん 1 日以内に返信
@MuhammadAhmad67889 がすでに取り組んでいます。
2026年11月26日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 79/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- next.js, react, typescript
- 領域
- frontend
調査の方向性
packages/ui/src/elements/CloseModalOnRouteChange/index.tsxから始め、v3の実装とv4のガード付きバージョンを比較します。Next 16でcacheComponents: trueとnext devを使うv3アプリで、コレクションの一覧からドキュメントを開いて再現します。ルート変更によって開いているモーダルが閉じ、最大更新深度エラーが発生しなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the Bug
CloseModalOnRouteChange (in @payloadcms/ui, 3.94.2) calls closeAllModals() every time its effect runs. With cacheComponents: true, React can re-run that effect without a route change, because Next keeps left pages mounted inside hidden <Activity> boundaries. Each closeAllModals() dispatch creates a new modal state even when no modal is open. That re-renders every modal consumer and runs the effect again, until React stops it with "Maximum update depth exceeded".
This is already fixed on the v4 line in #18702 ("feat: support cache components", see its "Render loop in dev" section). The fix closes modals only when the pathname actually changed and a modal is open. The current v3 release still has the unconditional call: packages/ui/src/elements/CloseModalOnRouteChange/index.tsx at v3.94.2 calls closeAllModalsEffectEvent() on every run, while v4.0.0-beta.12 has the guarded version. I couldn't find a backport PR. Could the #18702 guard be backported to 3.x?
Causal check: same server, same DB, same browser script, with the @payloadcms/ui client chunk rewritten in flight to drop only that closeAllModals() call.
| opens that looped | |
|---|---|
| unmodified | 17 / 30 |
closeAllModals() call removed |
0 / 30 |
Link to the code that reproduces this issue
No standalone repository: this was measured in a private app. The steps below reproduce it on any 3.x app with cacheComponents: true.
Reproduction Steps
- Take a Payload 3.x app (seen on 3.93.0; the code is unchanged in 3.94.2) on Next 16.4.x, with
cacheComponents: trueinnext.config. - Run
next dev, log in to the admin, open any collection's list view (an upload collection is enough), and click a row to open the document. - The document view throws "Maximum update depth exceeded". It depends on timing and happens on most opens: here 4–8 of every 6–9.
These do not loop:
- a production build (
next build+next start): 0 / 18 opens; - a full page load of the document URL: 0 / 12.
The loop happens on every collection, including one with no custom components or custom fields.
Which area(s) are affected?
area: ui
Environment Info
Payload: 3.93.0 (code unchanged in 3.94.2)
Next.js: 16.4.6
React: 19.2.4
next.config: cacheComponents: true
Mode: next dev only
Agent: Claude Code · claude-opus-5-5 · medium
- 主要言語
- TypeScript
- スター
- 46.1k
- フォーク
- 4.5k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 238
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
payloadcms/payload のほかの issue
-
db-postgres: date-only range on a single field drops every operator after the first (greater_than_equal + less_than_equal)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
payloadcms/payload#20110 ·
メンテナーはふだん 1 日以内に返信
-
website template: the seed button fails intermittently with a deadlock, because the seed clears collections in parallel対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: templates Bug db: postgres Payload OSS
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
payloadcms/payload#20019 ·
メンテナーはふだん 1 日以内に返信
-
Uploading a file whose name ends in a long number loops forever when the name is taken対応中かも @JayPokale が 7 日前に担当しました。 オープンarea: core Bug community-pr Payload OSS
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
payloadcms/payload#19978 ·
メンテナーはふだん 1 日以内に返信
-
[v4] A row whose fields are all hidden by their conditions still adds a field margin (regression from v3)対応中かも @paulw1982 が 7 日前に担当しました。 オープンarea: ui Bug community-pr created-by: Contributor Payload OSS status: needs-triage v3-only
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
payloadcms/payload#19976 ·
メンテナーはふだん 1 日以内に返信
-
refresh operation throws a TypeError (500) when the session is revoked between the JWT strategy read and its own read対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: core Bug Payload OSS
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
payloadcms/payload#19867 ·
メンテナーはふだん 1 日以内に返信
payloadcms/payload の issue をすべて見る
似ている issue
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openclaw/openclaw#212827 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Use one constant for the 10,000-character input limit対応中かも @NginxL が今日担当しました。 オープンgood first issue refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
aniru-dh21/snap-validate#51 ·
メンテナーはふだん 1 日以内に返信
-
dependencies effort: small good first issue priority: low
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
TMHSDigital/screencast-mcp#509 ·
メンテナーはふだん 1 日以内に返信
-
from-review tech-debt testing
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
blamechris/chroxy#9520 ·
メンテナーはふだん 1 日以内に返信