pmndrs / drei

🥉 useful helpers for react-three-fiber
https://docs.pmnd.rs/drei
MIT License
8.33k stars 689 forks source link

Stage component cause Error: Maximum update depth exceeded #1392

Closed rin-yato closed 1 year ago

rin-yato commented 1 year ago

Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
    at checkForNestedUpdates (react-reconciler.development.js:19378:11)
    at scheduleUpdateOnFiber (react-reconciler.development.js:17522:3)
    at dispatchSetState (react-reconciler.development.js:8564:16)
    at onCentered (Stage.js:102:7)
    at Center.js:40:7
    at commitHookEffectListMount (react-reconciler.development.js:14669:26)
    at commitLayoutEffectOnFiber (react-reconciler.development.js:14781:17)
    at commitLayoutMountEffects_complete (react-reconciler.development.js:16290:9)
    at commitLayoutEffects_begin (react-reconciler.development.js:16276:7)
    at commitLayoutEffects_begin (react-reconciler.development.js:16258:11)```
tompelsama commented 1 year ago

I got the same error.

FrancescoChichi commented 1 year ago

same error

brunosimon commented 1 year ago

Multiple students of Three.js Journey are reporting this too. Forcing the version to 9.50.3 exactly fixes it.

FrancescoChichi commented 1 year ago

same error with 9.50.3

FrancescoChichi commented 1 year ago
"@react-three/drei": "^9.50.3",
"@react-three/fiber": "^8.12.0",
tompelsama commented 1 year ago
"@react-three/drei": "^9.50.3",
"@react-three/fiber": "^8.12.0",

If you run npm install it will install the latest minor version which is 9.64.0. You should remove the caret to force the app to use that version. It should be like this 9.50.3

FrancescoChichi commented 1 year ago
"@react-three/drei": "^9.50.3",
"@react-three/fiber": "^8.12.0",

If you run npm install it will install the latest minor version which is 9.64.0. You should remove the caret to force the app to use that version. It should be like this 9.50.3

Thank you, i didn't know about the caret, not it works

sszczep commented 1 year ago

Same issue with:

"react": "18.2.0",
"three": "^0.151.3",
"@react-three/fiber": "^8.12.0",

Works fine on 9.50.3.

drcmda commented 1 year ago

should be fixed, in the version that's currently going through the CI

beeboopx commented 1 year ago

@drcmda should that merge also fix on React Native? Still getting it on drei/native v9.65.3 in RN v0.71.6.

kavsingh commented 1 year ago

Hi! am also still seeing this with

    "@react-three/drei": "9.65.3",
    "@react-three/fiber": "8.12.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "three": "0.151.3"

Code sandbox repro here: https://codesandbox.io/s/drei-stage-callstack-uongqs?file=/src/App.tsx The fixes seem to be released in 9.65.3? happens with and without React.StrictMode

thanks!

kavsingh commented 1 year ago

seems to be fixed in 9.65.5 🎉 https://codesandbox.io/s/drei-stage-callstack-forked-6ulxb3?file=/package.json thank you!!

stphn commented 1 year ago

Tested with: "@react-three/drei": "^9.68.3",

Seems to be fixed, that thread should can be closed