Skip to content

[compiler] Don’t treat JSX prop callbacks as render-invoked#36530

Open
Aniketiitk21 wants to merge 1 commit into
facebook:mainfrom
Aniketiitk21:codex/compiler-jsx-prop-callback-non-null
Open

[compiler] Don’t treat JSX prop callbacks as render-invoked#36530
Aniketiitk21 wants to merge 1 commit into
facebook:mainfrom
Aniketiitk21:codex/compiler-jsx-prop-callback-non-null

Conversation

@Aniketiitk21
Copy link
Copy Markdown

Summary

Fixes a React Compiler bug where JSX prop callbacks could be treated as render-invoked functions during hoistable property load collection.

That caused incorrect dependency tracking and could crash compiled output for cases like disabled={!test} combined with onClick={() => console.log(test!.value)}.

This PR narrows the render-invoked handling to the JSX tag itself, adds a regression fixture for the non-null assertion callback case, and updates the two affected useContext snapshots to reflect the corrected dependency behavior.

Test plan

  • Added bug-non-null-assertion-disabled-callback
  • Verified bug-non-null-assertion-disabled-callback
  • Verified useContext-read-context-in-callback
  • Verified useContext-maybe-mutate-context-in-callback

Fixes #35379.

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 24, 2026

Hi @Aniketiitk21!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@Aniketiitk21 Aniketiitk21 marked this pull request as ready for review May 24, 2026 11:02
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 24, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label May 24, 2026
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.

React Compiler generates erroneous code when an app contains a component named Symbol

1 participant