felixmariotto / three-mesh-ui

⏹ Make VR user interfaces for Three.js
https://felixmariotto.github.io/three-mesh-ui/#basic_setup
MIT License
1.3k stars 136 forks source link

deepDelete is this function working correctly? #268

Open michal-repo opened 1 year ago

michal-repo commented 1 year ago

I think that deepDelete from src/utils/deepDelete.js is not working correctly.

I can see that there is different version in examples/utils/deepDelete.js

Here is code example: https://codesandbox.io/s/exciting-antonelli-svcfcm?file=/src/index.js

../three-mesh-ui-6.5.4/utils/deepDelete.js is src/utils/deepDelete.js version ../three-mesh-ui-6.5.4/utils/deepDelete2.js is examples/utils/deepDelete.js version I have added some console logs.

There is one Block on scene (cube) with child Block (cube1) that have child InlineBlock in it. cube |_cube1 |_imgBlock

When running deepDelete from src/utils version there is only one log with top Block.

If you change import to deepDelete2 examples/utils version suddenly all children are logged in console and looks like removed correctly.

Which version of deepDelete is correct and should be used to remove objects?