fix(deps): update dependency @react-three/fiber to v9 #561
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^8.16.0
->^9.0.0
Release Notes
pmndrs/react-three-fiber (@react-three/fiber)
v9.0.4
Compare Source
What's Changed
Full Changelog: pmndrs/react-three-fiber@v9.0.3...v9.0.4
v9.0.3
Compare Source
What's Changed
Full Changelog: pmndrs/react-three-fiber@v9.0.2...v9.0.3
v9.0.2
Compare Source
What's Changed
Full Changelog: pmndrs/react-three-fiber@v9.0.1...v9.0.2
v9.0.1
Compare Source
What's Changed
Full Changelog: pmndrs/react-three-fiber@v9.0.0...v9.0.1
v9.0.0
Compare Source
This is a compatibility release for React 19, which brings further performance, stability, and type improvements. You can check out the React 19 changelog here.
We would like to express our gratitude to the community for their continued support, as well as to all our contributors, including the React team at Meta and Vercel, for ensuring this upgrade went smoothly. 🎉
Features
useLoader Accepts Loader Instance
useLoader
now supports re-use of external loader instances for more controlled pooling and setup.Factory extend Signature
extend
can now produce a component when a three.js class is passed to it individually instead of a catalog of named classes. This is backwards compatible and reduces TypeScript boilerplate and JSX collisions. We recommend libraries migrate to this signature so internal components don't clash with user-land declarations.Async GL prop
The Canvas GL prop accepts constructor parameters, properties, or a renderer instance via a callback. The callback now passes constructor parameters instead of just a canvas reference.
Further, a callback passed to GL can now return a promise for async constructors like
WebGPURenderer
(see WebGPU).WebGPU
Recent Three.js now includes a WebGPU renderer. While still a work in progress and not fully backward-compatible with all of Three's features, the renderer requires an async initialization method. R3F streamlines this by allowing the gl prop to return a promise.
Fixes
Color Management of Textures
Automatic sRGB conversion of texture props has been removed. Color textures are now handled automatically for built-in materials, aligning with vanilla Three.js behavior. This prevents issues where data textures (e.g., normals or displacement) become corrupted or non-linear. For custom materials or shaders, annotate color textures with
texture.colorSpace = THREE.SRGBColorSpace
ortexture-colorSpace={THREE.SRGBColorSpace}
in JSX.For more details, see https://threejs.org/docs/#manual/en/introduction/Color-management.
Suspense and Side-Effects
The handling of Suspense and fallback content has improved in React and R3F. Side-effects like attach and constructor effects (e.g., controls adding event listeners) no longer fire repeatedly without proper cleanup during suspension.
Swapping with args and primitives
Swapping elements when changing the
args
or primitiveobject
prop has been improved for structured children like arrays or iterators (React supports both, including async iterators). Previously, primitives sharing an object could update out of order or be removed from the scene along with their children.See: https://github.com/pmndrs/react-three-fiber/pull/3272
TypeScript Changes
Props renamed to CanvasProps
Canvas
Props
is now calledCanvasProps
for clarity. These were aliased in v8 for forward compatibility, butProps
is removed with v9.Dynamic JSX Types
Since R3F's creation, JSX types had to be maintained in accordance with additions to three core API. Although missing or future types could be ignored or resilient for forward and backwards compatibility, this was a major maintenance burden for us and those extending three. Furthermore, libraries which wrap or bind to the known catalog of elements (e.g. React Spring
<animated.mesh />
) had no way of knowing which elements belonged to a renderer.Since v8, we've added a catalog of known elements to a
ThreeElements
interface, and with v9 automatically map three API to JSX types. As types are now dynamically mapped, hardcoded exports likeMeshProps
have been removed, and can be accessed asThreeElements['mesh']
. Helper types likeColor
orVector3
remain to reflect the JSXMathType
API for shorthand expression.Node Helpers
Specialized
Node
type helpers for extending JSX (Node
,Object3DNode
,BufferGeometryNode
,MaterialNode
,LightNode
) are removed and combined into 'ThreeElement', which accepts a single type representing the extended element instance.ThreeElements
ThreeElements
was added as an interface since v8.1.0 and is the current way of declaring or accessing JSX within R3F since React's depreciation ofglobal
JSX (see https://react.dev/blog/2024/04/25/react-19-upgrade-guide#the-jsx-namespace-in-typescript). All JSX types belonging to R3F are accessible fromThreeElements
.Testing
StrictMode
StrictMode
is now correctly inherited from a parent renderer like react-dom. Previously,<StrictMode />
mounted in another root such as react-dom would not affect the R3F canvas, so it had to be redeclared within the canvas as well.Keep in mind, this change may affect the behavior of your application. If you encounter anything that worked before and fails now, profile it first in dev and then production. If it works in prod then strict mode has flushed out a side-effect in your code.
Act
act
is now exported from React itself and can be used for all renderers. It will return the contents of a passed async callback like before and recursively flush async effects to synchronously test React output.Full Changelog: pmndrs/react-three-fiber@v8.18.0...v9.0.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.