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

fix(transformer/jsx): incorrect isStaticChildren argument for Fragment with multiple children #8713

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions crates/oxc_transformer/src/jsx/jsx_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,9 @@ impl<'a> JsxImpl<'a, '_> {

// isStaticChildren
if is_development {
arguments.push(Argument::from(ctx.ast.expression_boolean_literal(
SPAN,
if is_fragment { false } else { children_len > 1 },
)));
arguments.push(Argument::from(
ctx.ast.expression_boolean_literal(SPAN, children_len > 1),
));
}

// Fragment doesn't have source and self
Expand Down
4 changes: 2 additions & 2 deletions tasks/transform_conformance/snapshots/oxc.snap.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
commit: acbc09a8

Passed: 132/154
Passed: 133/155

# All Passed:
* babel-plugin-transform-class-static-block
Expand Down Expand Up @@ -261,7 +261,7 @@ rebuilt : SymbolId(2): []
x Output mismatch


# babel-plugin-transform-react-jsx (34/37)
# babel-plugin-transform-react-jsx (35/38)
* refresh/does-not-transform-it-because-it-is-not-used-in-the-AST/input.jsx
x Output mismatch

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<>
<div></div>
<div></div>
</>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"plugins": [["transform-react-jsx-development"]],
"sourceType": "module"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var _jsxFileName = "<CWD>/tests/babel-plugin-transform-react-jsx/test/fixtures/fragment-static-children/input.jsx";
import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
_jsxDEV(_Fragment, { children: [_jsxDEV("div", {}, void 0, false, {
fileName: _jsxFileName,
lineNumber: 2,
columnNumber: 3
}, this), _jsxDEV("div", {}, void 0, false, {
fileName: _jsxFileName,
lineNumber: 3,
columnNumber: 3
}, this)] }, void 0, true);
Loading