Skip to content
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

[compiler] Fix dropped ref with spread props in InlineJsxTransform #31726

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

jackpope
Copy link
Contributor

When supporting ref as prop in #31558, I missed fixing the optimization to pass a spread-props-only props object in without an additional object copy. In the case that we have only a ref along with a spread, we cannot return only the spread object. This results in dropping the ref.

In this example

<Foo ref={ref} {...props} />

The bugged output is:

{
  // ...
  props: props
}

With this change we now get the correct output:

{
  // ...
  props: {ref: ref, ...props}
}

@jackpope jackpope requested a review from kassens December 10, 2024 20:21
Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 8:45pm

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