pmndrs / pmndrs/react-spring

three and web are incompatible

Open
#1,586 33 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: three area: web kind: bug
Dominant language
TypeScript
Stars
29.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

🐛 Bug Report

react-spring/web is not working when a @react-spring/three happens before, unless both is happeing in the same file. From here on this is just wild guessing from my side why this happens.

I am using react spring for a web and a threejs context. Respectivly importing both with

import { animated, useTransition, config, useSpring } from "@react-spring/web";
// or
import { useSpring, animated, config } from "@react-spring/three";

To Reproduce

Import a animated three component and a animated web component. The useSpring web component stops working:

bug

Expected behavior

Importing react-spring/three and react-spring/web both enable working springs no matter if imported from different files.

Link to repro (highly encouraged)

Working animations: https://codesandbox.io/s/single-file-69el5?file=/src/App.js
Non Working example: https://codesandbox.io/s/multi-file-11oph?file=/src/App.js

Environment

  • react-spring v9.2.3
  • react v17.0.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked single-file and multi-file CodeSandbox reproductions and compare imports from react-spring/web and react-spring/three. Trace the package entry points involved in those imports and verify that web springs still work when the three component is imported first; done means both reproductions animate correctly regardless of file boundaries or import order.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, three.js
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.