-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Table isRowHeader error (Next.js 13.3 + react-aria-components) #4390
Comments
Looks like Next.js is using an experimental version of react, roughly corresponding to the react@next tag on npm. This is only the case with the experimental appDir flag turned on. A recent behavior change in a refactor of React broke the hack we were using to pass through objects to "host" elements. react-spectrum/packages/react-aria-components/src/Collection.tsx Lines 749 to 755 in 76932d3
Now React will coerce the object to a boolean when setting the property: https://github.com/facebook/react/blob/b6006201b5fdfcc5720160f169b80ddb7b8d7467/packages/react-dom-bindings/src/client/ReactDOMComponent.js#L426-L429 We'll have to come up with an alternative. |
I would refactor function Item(props) {
let ref = useRef();
useLayoutEffect(() => {
ref.current.setProps(props);
}, [props]);
return <item ref={ref} />
} And then replace the This must be done in a layout effect so that it is completed before the |
🐛 Bug Report
Rendering a
Table
(w/TableHeader
,Column
children etc.) throws the following error:Error: A table must have at least one Column with the isRowHeader prop set to true
The error is thrown even if the prop is set on a Column.
next.config.js
SSRProvider
is usedI can only reproduce the issue in Next.js 13.3.0. Works fine in 13.2.4.
💻 Code Sample
Next.js 13.3.0 - broken:
https://codesandbox.io/p/sandbox/react-aria-next-js-13-3-0-broken-table-071o7w?file=%2Fapp%2Fpage.tsx
Next.js 13.2.4 (otherwise identical) - works:
https://codesandbox.io/p/sandbox/react-aria-next-js-13-2-4-working-table-t8keyk?file=%2Fapp%2Fpage.tsx
The text was updated successfully, but these errors were encountered: