Skip to content

Commit e7ab96c

Browse files
committed
fix(transformer/jsx): incorrect isStaticChildren argument for Fragment with multiple children (#8713)
close: #8650
1 parent bf8be23 commit e7ab96c

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

crates/oxc_transformer/src/jsx/jsx_impl.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,9 @@ impl<'a> JsxImpl<'a, '_> {
719719

720720
// isStaticChildren
721721
if is_development {
722-
arguments.push(Argument::from(ctx.ast.expression_boolean_literal(
723-
SPAN,
724-
if is_fragment { false } else { children_len > 1 },
725-
)));
722+
arguments.push(Argument::from(
723+
ctx.ast.expression_boolean_literal(SPAN, children_len > 1),
724+
));
726725
}
727726

728727
// Fragment doesn't have source and self

tasks/transform_conformance/snapshots/oxc.snap.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
commit: acbc09a8
22

3-
Passed: 132/154
3+
Passed: 133/155
44

55
# All Passed:
66
* babel-plugin-transform-class-static-block
@@ -261,7 +261,7 @@ rebuilt : SymbolId(2): []
261261
x Output mismatch
262262

263263

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

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

0 commit comments

Comments
 (0)