Skip to content

Commit 000f832

Browse files
committed
perf: do not call conclude when no function attr passed
1 parent b404262 commit 000f832

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ export default defineComponent({
129129
if (newAttrs.onChangeMode) {
130130
defaultFunctionAttrs.onChangeMode = onChangeMode
131131
}
132-
jsonEditor.value.updateProps(conclude([newAttrs, defaultFunctionAttrs], {
133-
camelCase: false,
134-
mergeFunction,
135-
}))
132+
jsonEditor.value.updateProps(Object.getOwnPropertyNames(defaultFunctionAttrs).length > 0
133+
? conclude([newAttrs, defaultFunctionAttrs], {
134+
camelCase: false,
135+
mergeFunction,
136+
})
137+
: newAttrs)
136138
}, {
137139
deep: true,
138140
})

0 commit comments

Comments
 (0)