react-three-fiber
react-three-fiber copied to clipboard
Breaking changes in React experimental branch
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
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.
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/[email protected][email protected]/node_modules/react-reconciler/cjs/react-reconciler.development.js (498:1)
createRenderer
node_modules/.pnpm/@[email protected][email protected][email protected]_5tpfayefndxx6u5t5hvu2nrgoe/node_modules/@react-three/fiber/dist/events-a5fc3e51.esm.js (223:32)
And at build time with
Failed to compile.
./node_modules/.pnpm/[email protected][email protected]/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/[email protected][email protected]/node_modules/its-fine/dist/index.js
./node_modules/.pnpm/@[email protected][email protected][email protected]_5tpfayefndxx6u5t5hvu2nrgoe/node_modules/@react-three/fiber/dist/react-three-fiber.esm.js
Let me know if there's any way I can help!
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 https://github.com/facebook/react/issues/28956.