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>
This commit is contained in:
Braks
2021-11-24 00:36:57 +01:00
parent f4559398f6
commit e065df5afc
+3 -2
View File
@@ -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 = ''