Skip to content

Commit

Permalink
fix: ensure parent for nodeOps target when key is a function
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Mar 26, 2023
1 parent ed79752 commit c07d963
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/nodeOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
},
patchProp(node, prop, _prevValue, nextValue) {
if (node) {
/* if (node.isCamera && prop === 'look-at') {
debugger
} */

let root = node
let key = prop
const camelKey = kebabToCamel(key)
Expand Down Expand Up @@ -152,8 +150,8 @@ export const nodeOps: RendererOptions<TresObject, TresObject> = {
if (value === '') value = true
// Set prop, prefer atomic methods if applicable
if (isFunction(target)) {
/* if (Array.isArray(value)) target(...value)
else target(value) */
if (Array.isArray(value)) node[camelKey](...value)
else node[camelKey](value)
return
}
if (!target?.set && !isFunction(target)) root[camelKey] = value
Expand Down

0 comments on commit c07d963

Please sign in to comment.