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

Breaking changes in React experimental branch #3222

Closed
Tracked by #2338
jackpope opened this issue Mar 27, 2024 · 5 comments
Closed
Tracked by #2338

Breaking changes in React experimental branch #3222

jackpope opened this issue Mar 27, 2024 · 5 comments

Comments

@jackpope
Copy link

React is preparing changes, including some breaking, for the next major release. There are changes to the Reconciler that break @react-three/fiber.

To repro:

  • Install react and react-dom @experimental
  • Load @react-three/fiber demo
  • Observe error

sandbox: https://codesandbox.io/p/sandbox/react-three-fiber-experimental-9hqh35

To prepare for the new versions, @react-three/fiber should build against the latest changes by upgrading react-reconciler, which requires new methods since 0.27.0. See all

@CodyJasonBennett
Copy link
Member

Thanks for looking out. We're aware of this and plan to upgrade our reconciler alongside React 19 with our v9 release. I can make a PR for this shortly.

@lourd
Copy link

lourd commented Aug 17, 2024

You're probably already aware of this, but adding my findings in case not. When trying React v19 on my personal site with a couple R3F sketches, they fail at runtime during dev with

Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner')

Call Stack
$$$reconciler
node_modules/.pnpm/react-reconciler@0.27.0_react@19.0.0-rc-f994737d14-20240522/node_modules/react-reconciler/cjs/react-reconciler.development.js (498:1)
createRenderer
node_modules/.pnpm/@react-three+fiber@8.17.5_react-dom@19.0.0-rc-f994737d14-20240522_react@19.0.0-rc-f994737d14-_5tpfayefndxx6u5t5hvu2nrgoe/node_modules/@react-three/fiber/dist/events-a5fc3e51.esm.js (223:32)

And at build time with

Failed to compile.

./node_modules/.pnpm/its-fine@1.1.1_react@19.0.0-rc-f994737d14-20240522/node_modules/its-fine/dist/index.js
Attempted import error: '__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' is not exported from 'react' (imported as 'React').

Import trace for requested module:
./node_modules/.pnpm/its-fine@1.1.1_react@19.0.0-rc-f994737d14-20240522/node_modules/its-fine/dist/index.js
./node_modules/.pnpm/@react-three+fiber@8.17.5_react-dom@19.0.0-rc-f994737d14-20240522_react@19.0.0-rc-f994737d14-_5tpfayefndxx6u5t5hvu2nrgoe/node_modules/@react-three/fiber/dist/react-three-fiber.esm.js

Let me know if there's any way I can help!

@CodyJasonBennett
Copy link
Member

React 19 is a breaking change and requires an upgrade for libraries to support it, with renderers requiring an extensive refactor and type changes. For R3F and the rest of the pmndrs ecosystem, we can't release support to stable until React 19 itself is out, which is frozen in RC due to unintended regressions with suspense and reconciliation. You can find a v9 alpha of R3F that supports React 19 as of the last RC with a migration guide, but I would not expect any haste in the ecosystem due to the lack of a timeline for React 19 stable. If you have any feedback during testing, I'd appreciate it in #2338, where we're tracking the v9 milestone. This issue has since been resolved, and am tracking minor cleanup upstream in facebook/react#28956.

@JehadurRE
Copy link

Is there any workaround to use @react-three/fiber with Next.js 15? I tried installing @react-three/fiber@9.0.0-alpha.8, but I'm encountering same issues. Specifically, I get warnings about unmet peer dependencies for react and react-dom, which require versions that aren't currently available,

npm WARN ERESOLVE overriding peer dependency  
npm WARN While resolving: @react-three/fiber@9.0.0-alpha.8  
npm WARN Found: react@undefined  
npm WARN Could not resolve dependency:  
npm WARN peer react@">=19.0" from @react-three/fiber@9.0.0-alpha.8  
...  
npm ERR! code ETARGET  
npm ERR! notarget No matching version found for react-dom@>=19.0.

@karlhorky
Copy link

karlhorky commented Oct 29, 2024

@JehadurRE have you tried @react-three/fiber@9.0.0-beta.1?

It seems that some users are having success with that and Next.js 15:

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

No branches or pull requests

5 participants