There was a breaking change in the RAC <Breadcrumb> component where the type of children in BreadcrumbProps changed from ReactNode to ReactNode | (props: RenderProps) => ReactNode.
This started causing type errors where BreadcrumbProps['children'] was being rendered in JSX as it's no longer a JSX compatible type.
There were no release notes for v1.3.2 or v1.3.3 so it was a bit tricky to track down, I'm creating this issue to document the change for others rather than expecting any kind of fix to be released.
😯 Current Behavior
import type { BreadcrumbProps } from 'react-aria-components';
import { Breadcrumb } from 'react-aria-components';
export function MyBreadcrumb(props: BreadcrumbProps) {
return (
<Breadcrumb {...props}>
<div className="my-style-wrapper">
{/* ok in react-aria-components 1.3.1, type error in 1.3.2 */}
{props.children}
</div>
</Breadcrumb>
);
}
💁 Possible Solution
Users of Breadcrumb can fix their code by using composeRenderProps:
import type { BreadcrumbProps } from 'react-aria-components';
import { Breadcrumb, composeRenderProps } from 'react-aria-components';
export function MyBreadcrumb(props: BreadcrumbProps) {
return (
<Breadcrumb {...props}>
{composeRenderProps(props.children, (children) => (
<div className="my-style-wrapper">{children}</div>
))}
</Breadcrumb>
);
}
🔦 Context
Our environment uses Renovate to automatically pick up new package versions.
When it picked up react-aria-components@1.3.2, the PR pipelines started failing due to this change in types.
🖥️ Steps to Reproduce
Install react-aria-components@1.3.1
Create a component that renders BreadcrumbProps['children'] as JSX
Provide a general summary of the issue here
There was a breaking change in the RAC
<Breadcrumb>
component where the type ofchildren
inBreadcrumbProps
changed fromReactNode
toReactNode | (props: RenderProps) => ReactNode
.see: https://github.com/adobe/react-spectrum/commit/660e768998b253af8233419437fab863d2b8c2cd#diff-3665b56a6e79754081f2590fccd7fbfb79570f1101922c5e71fea9e2360fccb5L71
This started causing type errors where
BreadcrumbProps['children']
was being rendered in JSX as it's no longer a JSX compatible type.There were no release notes for v1.3.2 or v1.3.3 so it was a bit tricky to track down, I'm creating this issue to document the change for others rather than expecting any kind of fix to be released.
😯 Current Behavior
💁 Possible Solution
Users of
Breadcrumb
can fix their code by usingcomposeRenderProps
:🔦 Context
Our environment uses Renovate to automatically pick up new package versions.
When it picked up react-aria-components@1.3.2, the PR pipelines started failing due to this change in types.
🖥️ Steps to Reproduce
BreadcrumbProps['children']
as JSXVersion
v1.3.2
What browsers are you seeing the problem on?
Other
If other, please specify.
No response
What operating system are you using?
MacOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response