fix(edges): create new effect scope when pane ready is called
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { CSSProperties } from 'vue'
|
import type { CSSProperties, EffectScope } from 'vue'
|
||||||
import EdgeWrapper from '../../components/Edges/Wrapper'
|
import EdgeWrapper from '../../components/Edges/Wrapper'
|
||||||
import ConnectionLine from '../../components/ConnectionLine/ConnectionLine.vue'
|
import ConnectionLine from '../../components/ConnectionLine/ConnectionLine.vue'
|
||||||
import { useEdgeHooks, useHandle, useVueFlow } from '../../composables'
|
import { useEdgeHooks, useHandle, useVueFlow } from '../../composables'
|
||||||
@@ -58,9 +58,11 @@ const hooks = $ref<Record<string, ReturnType<typeof useEdgeHooks>>>({})
|
|||||||
|
|
||||||
let groups = $ref<ReturnType<typeof groupEdgesByZLevel>>([])
|
let groups = $ref<ReturnType<typeof groupEdgesByZLevel>>([])
|
||||||
|
|
||||||
const scope = effectScope()
|
let scope: EffectScope | null = effectScope()
|
||||||
|
|
||||||
onPaneReady(() => {
|
onPaneReady(() => {
|
||||||
|
if (!scope) scope = effectScope()
|
||||||
|
|
||||||
scope.run(() => {
|
scope.run(() => {
|
||||||
const edgeAmount = computed(() => getEdges.length)
|
const edgeAmount = computed(() => getEdges.length)
|
||||||
|
|
||||||
@@ -92,7 +94,10 @@ onPaneReady(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => scope.stop())
|
onBeforeUnmount(() => {
|
||||||
|
scope?.stop()
|
||||||
|
scope = null
|
||||||
|
})
|
||||||
|
|
||||||
const getType = (type?: string, template?: GraphEdge['template']) => {
|
const getType = (type?: string, template?: GraphEdge['template']) => {
|
||||||
const name = type || 'default'
|
const name = type || 'default'
|
||||||
|
|||||||
Reference in New Issue
Block a user