Skip to content

feat: prepare react 19 compatibility#2810

Open
noahwaldner wants to merge 5 commits into
mainfrom
feat/prepare-react-19-compatibility
Open

feat: prepare react 19 compatibility#2810
noahwaldner wants to merge 5 commits into
mainfrom
feat/prepare-react-19-compatibility

Conversation

@noahwaldner

Copy link
Copy Markdown
Contributor

Prepares the packages components, icons and tokens to be compatible with react 19

  • Added CI script that runs a v19 typecheck on the repository to flag additions that would break v19 compatibility (while fondue uses v18 for development)

Code changes for v19 compatibility

  • useRef() without argument → explicit initial value
    @types/react@19 will make the argument required.
useRef<ReactNode>()  →  useRef<ReactNode>(undefined)
  • Ref-accepting parameters: RefObject<T> → RefObject<T | null>
    In react 19 useRef<T>(null) returns RefObject<T | null>; parameters must accept it. Backward-compatible in v18.
(ref: RefObject<HTMLElement>)  →  (ref: RefObject<HTMLElement | null>)
  • Refs in output positions: RefObject<T> → structural { current: T | null }
    Same nullability, but in return types/props the generic spelling fails react 18's covariance check, so the plain structural type is the only form valid under both.
triggerListRef: RefObject<HTMLDivElement>  →  triggerListRef: { current: HTMLDivElement | null }

- Duck-typed element narrowing → isValidElement<Props>()
react 19 changes ReactElement's default props from any to unknown, breaking .props access after manual checks.

typeof children === 'object' && children && 'props' in children  // then children.props.className
→  isValidElement<{ className?: string }>(children)
  • Bare JSX.Element annotations → ReactElement
    react 19 removes the global JSX namespace (now React.JSX / importable only).
(): JSX.Element =>  →  (): ReactElement
  • Removed ReactSVG type → self-contained local union
    react 19 deleted ReactSVG; its replacement SVGElementType in 18, and the type is publicly exported, so neither import works for both majors.
keyof ReactSVG  →  SVGElementTagName  // local union mirroring 19's SVGElementType
  • Public exports typed as raw (props, ref) functions → typed as the forwardRef result
    react 19's FunctionComponent lost its legacy context?: any second parameter, so two-argument functions are no longer valid component types
export const TextInput: typeof TextFieldRoot & {…}  →  typeof ForwardedRefTextFieldRoot & {…}

@noahwaldner
noahwaldner requested a review from a team as a code owner July 24, 2026 13:47
@noahwaldner
noahwaldner requested a review from syeo66 July 24, 2026 13:47
@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 019f33b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@frontify/fondue-components Patch
@frontify/fondue-tokens Patch
@frontify/fondue-icons Patch
@frontify/fondue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@noahwaldner
noahwaldner requested review from SamuelAlev and removed request for syeo66 July 24, 2026 13:48
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for fondue-components ready!

Name Link
🔨 Latest commit 480acf6
🔍 Latest deploy log https://app.netlify.com/projects/fondue-components/deploys/6a636d6837f78c00085c4dc7
😎 Deploy Preview https://deploy-preview-2810.components.fondue-components.frontify.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for fondue-components ready!

Name Link
🔨 Latest commit 5175dc3
🔍 Latest deploy log https://app.netlify.com/projects/fondue-components/deploys/6a636ea1eedd020008d5ef01
😎 Deploy Preview https://deploy-preview-2810.components.fondue-components.frontify.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants