fix: remove deep flag from elements and store-elements watcher

* deep watching causes a reset after positions change
* fallback to non-worker parsing

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-23 13:55:41 +01:00
parent 1f77b77fe7
commit 9ec1c4dc2b
3 changed files with 4 additions and 3 deletions
-1
View File
@@ -64,7 +64,6 @@ const toggleclasss = () => {
:min-zoom="0.2" :min-zoom="0.2"
:max-zoom="4" :max-zoom="4"
:zoom-on-scroll="false" :zoom-on-scroll="false"
:worker="true"
@elements-remove="onElementsRemove" @elements-remove="onElementsRemove"
@connect="onConnect" @connect="onConnect"
@node-drag-stop="onNodeDragStop" @node-drag-stop="onNodeDragStop"
+2 -2
View File
@@ -163,8 +163,8 @@ invoke(async () => {
) )
}) })
throttledWatch(elements, store.setElements, { flush: 'post', deep: true, throttle: 10 }) throttledWatch(elements, store.setElements, { flush: 'post', throttle: 10 })
throttledWatch(store.elements, (val) => (elements.value = val), { flush: 'post', deep: true, throttle: 10 }) throttledWatch(store.elements, (val) => (elements.value = val), { flush: 'post', throttle: 10 })
const transitionName = computed(() => { const transitionName = computed(() => {
let name = '' let name = ''
+2
View File
@@ -86,6 +86,8 @@ export default (id: string, preloadedState: FlowState) => {
workerTerminate('SUCCESS') workerTerminate('SUCCESS')
next = res next = res
} else next = await parseElements(elements, this.nodes, this.edges, this.nodeExtent) } else next = await parseElements(elements, this.nodes, this.edges, this.nodeExtent)
} else {
next = await parseElements(elements, this.nodes, this.edges, this.nodeExtent)
} }
this.elements = [...next.nextNodes, ...next.nextEdges] this.elements = [...next.nextNodes, ...next.nextEdges]
this.nodes = next.nextNodes ?? [] this.nodes = next.nextNodes ?? []