diff --git a/src/container/VueFlow/VueFlow.vue b/src/container/VueFlow/VueFlow.vue index 3cad1375..ad20f503 100644 --- a/src/container/VueFlow/VueFlow.vue +++ b/src/container/VueFlow/VueFlow.vue @@ -11,7 +11,6 @@ import { NodeExtent, NodeTypes, EdgeTypes, - FlowState, FlowInstance, Loading, FlowOptions, @@ -116,7 +115,7 @@ const options = Object.assign({}, store.$state, props) invoke(async () => { store.setState(options) - store.setElements(elements.value) + await store.setElements(elements.value) store.isReady = true // if ssr we can't wait for dimensions, they'll never really exist @@ -139,26 +138,25 @@ invoke(async () => { store.instance = instance watch( () => props, - () => store.setState({ ...store.$state, ...props } as FlowState), + () => store.setState(props), + { flush: 'post', deep: true }, + ) + watch( + () => props.modelValue.length, + () => store.setElements(elements.value), + ) + const { pause, resume } = pausableWatch(elements, store.setElements, { flush: 'post' }) + watch( + () => store.elements, + (val) => { + pause() + elements.value = val + nextTick(resume) + }, { flush: 'post', deep: true }, ) }) -watch( - () => props.modelValue.length, - () => store.setElements(elements.value), -) -const { pause, resume } = pausableWatch(elements, store.setElements, { flush: 'post' }) -watch( - () => store.elements, - (val) => { - pause() - elements.value = val - nextTick(resume) - }, - { flush: 'post', deep: true }, -) - const transitionName = computed(() => { let name = '' if (typeof store.loading === 'object' && store.loading.transition) { @@ -170,6 +168,11 @@ const transitionName = computed(() => { onBeforeUnmount(() => store?.$dispose()) +