From 48da1eccba8ed6d1e89fd3c9b3c595afbb716dcf Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 19 Nov 2021 02:44:48 +0100 Subject: [PATCH] update: merge props with state objects Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- src/container/VueFlow/VueFlow.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/container/VueFlow/VueFlow.vue b/src/container/VueFlow/VueFlow.vue index 1e3e45d7..303514db 100644 --- a/src/container/VueFlow/VueFlow.vue +++ b/src/container/VueFlow/VueFlow.vue @@ -105,7 +105,11 @@ const { store, hooks } = initFlow(emit, props) const init = (opts: typeof props) => { for (const opt of Object.keys(opts)) { const val = opts[opt as keyof FlowProps] - if (val && typeof val !== 'undefined') (store.$state as any)[opt] = val + if (val && typeof val !== 'undefined') { + if (typeof val === 'object' && !Array.isArray(val)) { + ;(store.$state as any)[opt] = { ...(store.$state as any)[opt], ...val } + } else (store.$state as any)[opt] = val + } } store.setElements(store.elements) store.setMinZoom(opts.minZoom)