[v3] Maximum update depth exceeded opening a document from the list view with cacheComponents: true (dev): backport #18702's CloseModalOnRouteChange guard
I maintainer di solito rispondono entro 1 giorno
@MuhammadAhmad67889 ci sta già lavorando.
Dal 26/11/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 79/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- next.js, react, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia da packages/ui/src/elements/CloseModalOnRouteChange/index.tsx e confronta l’implementazione di v3 con la versione protetta di v4. Riproduci il problema in un’app v3 usando Next 16, cacheComponents: true e next dev, aprendo un documento da un elenco di una collection. Il lavoro è completato quando il cambio di route chiude le modali aperte senza attivare l’errore di profondità massima degli aggiornamenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 46.1k
- Fork
- 4.5k
- Merge medio
- 2g 15h
- PR unite (30g)
- 238
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di payloadcms/payload
-
db-postgres: date-only range on a single field drops every operator after the first (greater_than_equal + less_than_equal)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
payloadcms/payload#20110 ·
I maintainer di solito rispondono entro 1 giorno
-
website template: the seed button fails intermittently with a deadlock, because the seed clears collections in parallelForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea: templates Bug db: postgres Payload OSS
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
payloadcms/payload#20019 ·
I maintainer di solito rispondono entro 1 giorno
-
Uploading a file whose name ends in a long number loops forever when the name is takenForse già presa @JayPokale l’ha presa 7 giorni fa. Apertaarea: core Bug community-pr Payload OSS
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
payloadcms/payload#19978 ·
I maintainer di solito rispondono entro 1 giorno
-
[v4] A row whose fields are all hidden by their conditions still adds a field margin (regression from v3)Forse già presa @paulw1982 l’ha presa 7 giorni fa. Apertaarea: ui Bug community-pr created-by: Contributor Payload OSS status: needs-triage v3-only
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
payloadcms/payload#19976 ·
I maintainer di solito rispondono entro 1 giorno
-
refresh operation throws a TypeError (500) when the session is revoked between the JWT strategy read and its own readForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea: core Bug Payload OSS
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
payloadcms/payload#19867 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di payloadcms/payload
Issue simili
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openclaw/openclaw#212827 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Use one constant for the 10,000-character input limitForse già presa @NginxL l’ha presa oggi. Apertagood first issue refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aniru-dh21/snap-validate#51 ·
I maintainer di solito rispondono entro 1 giorno
-
dependencies effort: small good first issue priority: low
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
TMHSDigital/screencast-mcp#509 ·
I maintainer di solito rispondono entro 1 giorno
-
from-review tech-debt testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
blamechris/chroxy#9520 ·
I maintainer di solito rispondono entro 1 giorno