Skip to content

[flags] clean up enableAsyncDebugInfo - #37772

Merged
rickhanlonii merged 1 commit into
rh/land-parallel-transitionsfrom
rh/land-async-debug
Oct 7, 2026
Merged

rickhanlonii merged 1 commit into
rh/land-parallel-transitionsfrom
rh/land-async-debug

Conversation

@rickhanlonii

Copy link
Copy Markdown
Member

this is landed everywhere

@rickhanlonii
rickhanlonii added this pull request to stack #37773 October 7, 2026 16:22
@meta-cla meta-cla Bot added the CLA Signed label Oct 7, 2026
@rickhanlonii
rickhanlonii merged commit 3915aeb into main Oct 7, 2026
239 checks passed
eps1lon pushed a commit that referenced this pull request Oct 12, 2026
…37796)

Fixes #37795

## Summary

In DEV, `trackUsedThenable` infers async debug info for a used thenable
by attaching a `_debugInfo` expando:

```js
if (__DEV__ && thenable._debugInfo === undefined) {
  ...
  thenable._debugInfo = [{awaited: ioInfo}]; // throws on non-extensible objects
```

If the thenable was made non-extensible — e.g. a userspace-instrumented
thenable (one that already carries a `status`) frozen by an immutable
cache before being passed to `use()` — the assignment throws `TypeError:
Cannot add property _debugInfo, object is not extensible` from inside
React, crashing the render in development while the same code works in
production.

Since #37772 landed the `enableAsyncDebugInfo` flag for OSS, this path
runs for every `use(thenable)` call in DEV, so such thenables now crash
where they previously unwrapped fine.

This PR skips the debug-info inference when the thenable doesn't allow
new properties, mirroring the existing guard for frozen values in
Flight's `addAsyncInfo` (`ReactFlightClient.js`), which already skips
`_debugInfo` for frozen values ("Debug info is dropped for frozen
elements"). Debug info is simply dropped for such thenables; `use()`
unwraps the value normally.

Note: a *non-instrumented* frozen promise
(`use(Object.freeze(promise))`) still hits the pre-existing
`pendingThenable.status = 'pending'` assignment in the `default` branch,
which requires a different fix (e.g. a WeakMap fallback) — I've flagged
that separately in the issue.

## How did you test this change?

- Added a regression test in `ReactUse-test.js` (frozen,
userspace-instrumented thenable passed to `use()`), which fails on
`main` with `TypeError: Cannot add property _debugInfo, object is not
extensible` at `ReactFiberThenable.js:192` and passes with this fix.
- `yarn test packages/react-reconciler` — 77 suites, 1147 tests passed.
- `yarn test packages/react-reconciler/src/__tests__/ReactUse-test.js`
in both dev and `--prod` modes — 51 tests passed each.
- Related suites pass: `ReactSuspense-test.internal.js`,
`ReactSuspenseWithNoopRenderer-test.js`, `ReactLazy-test.internal.js`,
`ReactConditionalUseWarning-test.js`,
`ReactFlightAsyncDebugInfo-test.js`.
- `npx eslint` and `npx prettier --check` clean on both changed files;
`yarn flow dom-node` passes.

Co-authored-by: zhoubiao188 <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Oct 12, 2026
…37796)

Fixes #37795

## Summary

In DEV, `trackUsedThenable` infers async debug info for a used thenable
by attaching a `_debugInfo` expando:

```js
if (__DEV__ && thenable._debugInfo === undefined) {
  ...
  thenable._debugInfo = [{awaited: ioInfo}]; // throws on non-extensible objects
```

If the thenable was made non-extensible — e.g. a userspace-instrumented
thenable (one that already carries a `status`) frozen by an immutable
cache before being passed to `use()` — the assignment throws `TypeError:
Cannot add property _debugInfo, object is not extensible` from inside
React, crashing the render in development while the same code works in
production.

Since #37772 landed the `enableAsyncDebugInfo` flag for OSS, this path
runs for every `use(thenable)` call in DEV, so such thenables now crash
where they previously unwrapped fine.

This PR skips the debug-info inference when the thenable doesn't allow
new properties, mirroring the existing guard for frozen values in
Flight's `addAsyncInfo` (`ReactFlightClient.js`), which already skips
`_debugInfo` for frozen values ("Debug info is dropped for frozen
elements"). Debug info is simply dropped for such thenables; `use()`
unwraps the value normally.

Note: a *non-instrumented* frozen promise
(`use(Object.freeze(promise))`) still hits the pre-existing
`pendingThenable.status = 'pending'` assignment in the `default` branch,
which requires a different fix (e.g. a WeakMap fallback) — I've flagged
that separately in the issue.

## How did you test this change?

- Added a regression test in `ReactUse-test.js` (frozen,
userspace-instrumented thenable passed to `use()`), which fails on
`main` with `TypeError: Cannot add property _debugInfo, object is not
extensible` at `ReactFiberThenable.js:192` and passes with this fix.
- `yarn test packages/react-reconciler` — 77 suites, 1147 tests passed.
- `yarn test packages/react-reconciler/src/__tests__/ReactUse-test.js`
in both dev and `--prod` modes — 51 tests passed each.
- Related suites pass: `ReactSuspense-test.internal.js`,
`ReactSuspenseWithNoopRenderer-test.js`, `ReactLazy-test.internal.js`,
`ReactConditionalUseWarning-test.js`,
`ReactFlightAsyncDebugInfo-test.js`.
- `npx eslint` and `npx prettier --check` clean on both changed files;
`yarn flow dom-node` passes.

Co-authored-by: zhoubiao188 <[email protected]>

DiffTrain build for [259980d](259980d)
github-actions Bot pushed a commit that referenced this pull request Oct 12, 2026
…37796)

Fixes #37795

## Summary

In DEV, `trackUsedThenable` infers async debug info for a used thenable
by attaching a `_debugInfo` expando:

```js
if (__DEV__ && thenable._debugInfo === undefined) {
  ...
  thenable._debugInfo = [{awaited: ioInfo}]; // throws on non-extensible objects
```

If the thenable was made non-extensible — e.g. a userspace-instrumented
thenable (one that already carries a `status`) frozen by an immutable
cache before being passed to `use()` — the assignment throws `TypeError:
Cannot add property _debugInfo, object is not extensible` from inside
React, crashing the render in development while the same code works in
production.

Since #37772 landed the `enableAsyncDebugInfo` flag for OSS, this path
runs for every `use(thenable)` call in DEV, so such thenables now crash
where they previously unwrapped fine.

This PR skips the debug-info inference when the thenable doesn't allow
new properties, mirroring the existing guard for frozen values in
Flight's `addAsyncInfo` (`ReactFlightClient.js`), which already skips
`_debugInfo` for frozen values ("Debug info is dropped for frozen
elements"). Debug info is simply dropped for such thenables; `use()`
unwraps the value normally.

Note: a *non-instrumented* frozen promise
(`use(Object.freeze(promise))`) still hits the pre-existing
`pendingThenable.status = 'pending'` assignment in the `default` branch,
which requires a different fix (e.g. a WeakMap fallback) — I've flagged
that separately in the issue.

## How did you test this change?

- Added a regression test in `ReactUse-test.js` (frozen,
userspace-instrumented thenable passed to `use()`), which fails on
`main` with `TypeError: Cannot add property _debugInfo, object is not
extensible` at `ReactFiberThenable.js:192` and passes with this fix.
- `yarn test packages/react-reconciler` — 77 suites, 1147 tests passed.
- `yarn test packages/react-reconciler/src/__tests__/ReactUse-test.js`
in both dev and `--prod` modes — 51 tests passed each.
- Related suites pass: `ReactSuspense-test.internal.js`,
`ReactSuspenseWithNoopRenderer-test.js`, `ReactLazy-test.internal.js`,
`ReactConditionalUseWarning-test.js`,
`ReactFlightAsyncDebugInfo-test.js`.
- `npx eslint` and `npx prettier --check` clean on both changed files;
`yarn flow dom-node` passes.

Co-authored-by: zhoubiao188 <[email protected]>

DiffTrain build for [259980d](259980d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants