Skip to content

Conversation

@kostya-gromov
Copy link

Fixes #35268

This update modifies the constant propagation implementation to include a new function that collects JSX tag identifiers. The applyConstantPropagation function is updated to utilize these identifiers, improving the handling of local JSX tags during constant evaluation. Additionally, test fixtures are adjusted to reflect changes in JSX tag evaluation order and local tag usage.

  • Fix React Compiler constant propagation so it no longer replaces JSX tag aliases with their constant values. The compiler now tracks identifiers that appear in JSX tag position and skips propagating through their defining loads, ensuring stays an identifier instead of turning into <base />.
  • Add a regression fixture (repro-jsx-dynamic-tag-alias) that mirrors the reported repro to prevent regressions.

@meta-cla
Copy link

meta-cla bot commented Dec 4, 2025

Hi @kostya-gromov!

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 [email protected]. Thanks!

@kostya-gromov kostya-gromov changed the title Incorrectly uses variable name issue 35268 [compiler]: Incorrectly uses variable name issue 35268 Dec 4, 2025
@meta-cla
Copy link

meta-cla bot commented Dec 4, 2025

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 Dec 4, 2025
Copy link
Member

@josephsavona josephsavona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your interest in contributing! This is overly broad so we won't be able to use this approach. The right fix is to promote the LoadGlobal to a jsx temporary

@kostya-gromov
Copy link
Author

Thanks for your interest in contributing! This is overly broad so we won't be able to use this approach. The right fix is to promote the LoadGlobal to a jsx temporary

Hey @josephsavona,
Thank you for the review!

I’ve pushed another commit with the updated changes.
This is my first contribution to React, so please let me know if I’m still missing something — I really appreciate your guidance.

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.

[Compiler Bug]: incorrectly uses variable name as JSX tag (<base />) instead of referenced value

3 participants