brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
821 stars 105 forks source link

Fix: Update render to execute injectIntoDevTools once #308

Open Warchino opened 8 months ago

Warchino commented 8 months ago

This PR solves the error: image

This is reproducible when we try to unmount a Scene to generate a new component changing the key react prop: https://codesandbox.io/p/sandbox/codesandbox-react-tsx-forked-chj46s

Please open the codesanbox repro example in a separate tab, because only happens when your browser has React DevTools extension.

This fix is based on this issue: https://github.com/pixijs/pixi-react/issues/251

Warchino commented 8 months ago

Hey @brianzinn please take a look to this PR.

brianzinn commented 3 months ago

First of all thank-you for your contribution and sorry for leaving this so long. I am trying to clean up the issues and merge all the PRs. if you are still available and willing... The code-sandbox is really helpful, but I am unable to reproduce on FF or Edge with React Dev Tools. I am clicking the "GenerateKey" button and it resets the scene correctly with no errors and the Components tab seems to be working. I don't know if Dev Tools has been updated in the interim to allow being called multiple times or if I am doing something incorrectly.