Open saitonakamura opened 3 years ago
What is interesting is that createInstance
(branch when instance.__r3f.instance
is true) respects non-array args. Maybe it should be fixed in r3f?
Hi @saitonakamura, I'm afraid I won't be able to help with this one, as I don't use r3f at all myself, and the lib is primarily intended for native three.js. If you find a solution involving updating three-mesh-ui, I'm happy to look into your PR.
Repro: press click in the sandbox
It has to do with the this piece of code in fiber reconciler. If the component is not a r3f instance (
instance.__r3f.instance
flag indicates it), then r3f assumes that args will be an array (because three js constructors usually have multiple arguments). Obviously it fails with an object.What I don't understand is whether three-ui-component should be an instance or not. Instance components examples are OrbitControls, mesh, PerspectiveCamera. Non-instance are materials, ambientLight