-
-
Notifications
You must be signed in to change notification settings - Fork 721
fix(transformer/react): spread props optimization breaks __self and __source injection (#13009) #13020
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
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where the JSX transformer's spread props optimization was incorrectly applied when development plugins (jsx_self and jsx_source) are enabled. The optimization that converts {...props} to props when it's the only attribute was preventing proper merging of injected __self and __source props in development mode.
Key changes:
- Added condition to disable spread props optimization when dev plugins are active
- Added test case to verify correct behavior with classic runtime and development plugins
- Updated test snapshots to reflect the new passing test
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_transformer/src/jsx/jsx_impl.rs | Added condition to preserve spread syntax when jsx_self or jsx_source plugins are enabled |
| tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/spread-props-classic/input.jsx | Test input with spread props in JSX element |
| tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/spread-props-classic/options.json | Test configuration enabling development transform with classic runtime |
| tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/spread-props-classic/output.js | Expected output showing preserved spread syntax with injected __self and __source props |
| tasks/transform_conformance/snapshots/oxc.snap.md | Updated test count from 182/302 to 183/303 passing tests |
CodSpeed Instrumentation Performance ReportMerging #13020 will not alter performanceComparing Summary
|
overlookmotel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
Pushed a commit to update conformance snapshots (just the usual churn in TS semantic). Hopefully it'll merge now.
Merge activity
|
…_source injection (#13009) (#13020) * Fixes #13009 The optimization that converts `{...props}` to `props` when it's the only attribute was incorrectly applied even when `jsx_self` or `jsx_source` plugins are enabled. This caused `__self` and `__source` props to not be merged properly, resulting in incorrect transformation output in development mode. This fix disables the optimization when these dev plugins are active, ensuring spread props are preserved for proper merging.
8eb729c to
6fe0bb5
Compare
…_source injection (oxc-project#13009) (oxc-project#13020) * Fixes oxc-project#13009 The optimization that converts `{...props}` to `props` when it's the only attribute was incorrectly applied even when `jsx_self` or `jsx_source` plugins are enabled. This caused `__self` and `__source` props to not be merged properly, resulting in incorrect transformation output in development mode. This fix disables the optimization when these dev plugins are active, ensuring spread props are preserved for proper merging.

The optimization that converts
{...props}topropswhen it's the only attribute was incorrectly applied even whenjsx_selforjsx_sourceplugins are enabled. This caused__selfand__sourceprops to not be merged properly,resulting in incorrect transformation output in development mode.
This fix disables the optimization when these dev plugins are active, ensuring spread props are preserved for proper merging.