react 19 (v9) createPortal bug
Hey :)
An issue was reported to me that I identified to be a bug in react-three/fiber. I've created an reproduction repo here: https://github.com/bbohlender/r3f-portal-bug
Steps to reproduce
npm install&npm run dev- notice that no mesh is bound to the camera (hotpink cube)
- change react, react-dom, react-three/fiber and react-three/drei to the according react 18 deps
- run
npm installagain, clear the vite deps, and runnpm run devagain - notice that the mesh is now visible and bound to the camera (hotpink cube)
The issue seems to be that when the container of createPortal changes, the children are still bound to the previous container, which only happens after the upgrade to react 19 (including the react-three/fiber and drei deps).
Let me know if I can help with anything :)
This may be fixed by: https://github.com/pmndrs/react-three-fiber/pull/3488
The PR fixed another related bug, but this issue still persists.
It looks like my fix didn't resolve the issue, just the simple test I set up. I'll investigate more this weekend.