From e065df5afcf786da99819ca456738f06d1686cc7 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 24 Nov 2021 00:36:57 +0100 Subject: [PATCH] fix(flow): Add watcher that observes elements length for re-parsing * instead of deeply watching the elements' arr (which would cause a re-parsing on any element pos change, like dragging a node) we watch the elements + elements arr length and re-parse as necessary Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- src/container/VueFlow/VueFlow.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/container/VueFlow/VueFlow.vue b/src/container/VueFlow/VueFlow.vue index 8e1c5728..bbd652da 100644 --- a/src/container/VueFlow/VueFlow.vue +++ b/src/container/VueFlow/VueFlow.vue @@ -166,8 +166,9 @@ invoke(async () => { ) }) -throttledWatch(elements, store.setElements, { flush: 'post', throttle: 10 }) -throttledWatch(store.elements, (val) => (elements.value = val), { flush: 'post', throttle: 10 }) +watch(elements, store.setElements, { flush: 'post' }) +watch(() => elements.value.length, () => store.setElements(elements.value), { flush: 'post' }) +watch(store.elements, (val) => (elements.value = val), { flush: 'post' }) const transitionName = computed(() => { let name = ''