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

transformer: incorrect isStaticChildren value for fragments with static children #8650

Open
sapphi-red opened this issue Jan 22, 2025 · 0 comments
Assignees
Labels
C-bug Category - Bug

Comments

@sapphi-red
Copy link
Contributor

sapphi-red commented Jan 22, 2025

For input,

const foo = () => {
  return <>
    <p>foo</p>
    <p>foo</p>
  </>
}

oxc tranform outputs:

var _jsxFileName = "foo.jsx";
import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
const foo = () => {
        return _jsxDEV(_Fragment, { children: [_jsxDEV("p", { children: "foo" }, void 0, false, {
                fileName: _jsxFileName,
                lineNumber: 4,
                columnNumber: 5
        }, this), _jsxDEV("p", { children: "foo" }, void 0, false, {
                fileName: _jsxFileName,
                lineNumber: 5,
                columnNumber: 5
        }, this)] }, void 0, false);
};

The forth argument of _jsxDEV for _Fragment is false. This should be true.
reproduction using transform function from rolldown

If this is false, Warning: Each child in a list should have a unique "key" prop. error happens with React.

esbuild try with the same input

I found this while testing rolldown-vite on ecosystem-ci.

@sapphi-red sapphi-red added the C-bug Category - Bug label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

2 participants