You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Cache Components] correctly label IO promises in devtools (#84928)
Updates to staged rendering (cacheComponents dev) to support "suspended
by" in Suspense Devtools
- promises for `cookies()` and other user-callable APIs are now created
before we start the render. Each call to `cookies()` will return the
same promise (although currently it's wrapped in a fresh proxy). The
promise is created via `new Promise`, triggered by a timeout (for the
relevant stage) and has `displayName`. This marks it as an IO operation.
By re-using the same promise, we make sure that all callsites that await
it are considered to be suspended by the same IO operation.
- promises for `params` and `searchParams` use a similar trick. All
instances of `params` and will be derived from one shared IO promise
`sharedParamsParent`. When determining "suspended by", React will walk
up the promise chain, find this parent, and use its `displayName`, which
we set to `"params"`. `searchParams` work analogously
---------
Co-authored-by: Josh Story <story@hey.com>
0 commit comments