Skip to content

[Flight] Fix debug info leaking to outer handler #34081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2025

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Aug 1, 2025

The waitForReference call for debug info can trigger inside a different object's initializingHandler. In that case, we can get confused by which one is the root object.

We have this special case to detect if the initializing handler's object is null and we have an empty string key, then we should replace the root object's value with the resolved value.

if (key === '' && handler.value === null) {

However, if the initializing handler actually should have the value null then we might get confused by this and replace it with the resolved value from a debug object. This fixes it by just using a non-empty string as the key for the waitForReference on debug value since we're not going to use it anyway.

It used to be impossible to get into this state since a null value at the root couldn't have any reference inside itself but now the debug info for a null value can have outstanding references.

However, a better fix might be using a placeholder marker object instead of null or better yet ensuring that we know which root we're initializing in the debug model.

@meta-cla meta-cla bot added the CLA Signed label Aug 1, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Aug 1, 2025
@react-sizebot
Copy link

Comparing: 52612a7...23e895f

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 530.04 kB 530.04 kB = 93.63 kB 93.63 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 654.48 kB 654.48 kB = 115.34 kB 115.34 kB
facebook-www/ReactDOM-prod.classic.js = 674.42 kB 674.42 kB = 118.68 kB 118.68 kB
facebook-www/ReactDOM-prod.modern.js = 664.84 kB 664.84 kB = 117.02 kB 117.02 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 23e895f

@sebmarkbage sebmarkbage merged commit 538ac7a into facebook:main Aug 1, 2025
247 of 248 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants