Browse Source

fix: args should be empty when args was falsy

enpitsulin 1 year ago
parent
commit
291cfb1691
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/core/nodeOps.ts

+ 4 - 2
src/core/nodeOps.ts

@@ -184,10 +184,12 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
       let finalKey = kebabToCamel(key)
       let target = root?.[finalKey]
 
-      if (key === 'args' && !deepArrayEqual(_prevValue, nextValue)) {
+      if (key === 'args') {
         const prevNode = node as TresObject3D
+        const prevArgs = _prevValue ?? []
+        const args = nextValue ?? []
 
-        if (node.type && nextValue.length > 0) {
+        if (node.type && !deepArrayEqual(prevArgs, args)) {
           root = Object.assign(prevNode, new catalogue.value[node.type](...nextValue))
         }
         return