Skip to content

[ENHANCEMENT] Add support for React 19+ - #889

Draft
Gladorme wants to merge 2 commits into
perses:mainfrom
Gladorme:agents/react-compiler-support-18-19
Draft

Gladorme wants to merge 2 commits into
perses:mainfrom
Gladorme:agents/react-compiler-support-18-19

Conversation

@Gladorme

@Gladorme Gladorme commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Description

Depends on PR: perses/shared#390.
Add support for React 19+, while still keeping React 18 as base.
Related to perses/perses#4578

Done by IA (Opus 5.5)

Screenshots

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>
Signed-off-by: Guillaume LADORME <Gladorme@users.noreply.github.com>

@Nexucis Nexucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Together with perses/shared#390, the use-resize-observer v10 migration and the wider react/react-dom ranges look good.

One thing still prevents plugins from running on a React 19 host. The lockfile still builds plugins with React 18.3.1, and plugins share only react and react-dom, so every bundle includes React 18's react/jsx-runtime. On a React 19 host, that runtime gets the shared React 19 as react and crashes as soon as it loads:

Cannot read properties of undefined (reading 'ReactCurrentOwner')

I reproduced this with React 18.3.1's production runtime against React 19. Until it's fixed, the READMEs' "requires react and react-dom 18 or 19" doesn't hold at runtime. The host-side change is suggested in perses/shared#390.

Comment on lines +26 to +27
react: { requiredVersion: '^18.2.0 || ^19.0.0', singleton: true },
'react-dom': { requiredVersion: '^18.2.0 || ^19.0.0', singleton: true },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This applies to every plugin's rsbuild.config.ts. Sharing the JSX runtime makes the plugin use the host's runtime (React 18 or 19) instead of the bundled React 18 one. The host also has to provide it (suggested in perses/shared#390).

Suggested change
react: { requiredVersion: '^18.2.0 || ^19.0.0', singleton: true },
'react-dom': { requiredVersion: '^18.2.0 || ^19.0.0', singleton: true },
react: { requiredVersion: '^18.2.0 || ^19.0.0', singleton: true },
'react-dom': { requiredVersion: '^18.2.0 || ^19.0.0', singleton: true },
'react/jsx-runtime': { requiredVersion: '^18.2.0 || ^19.0.0', singleton: true },

Dev builds use react/jsx-dev-runtime instead, so plugin dev mode against a React 19 host is worth checking too.

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