diff --git a/src/container/ZoomPane/ZoomPane.vue b/src/container/ZoomPane/ZoomPane.vue index 905bf40c..8a9d3206 100644 --- a/src/container/ZoomPane/ZoomPane.vue +++ b/src/container/ZoomPane/ZoomPane.vue @@ -197,6 +197,7 @@ invoke(async () => { } store.hooks.load.trigger(instance) store.isReady = true + store.instance = instance }) watch( diff --git a/src/store/flowStore.ts b/src/store/flowStore.ts index 11865c2e..9a69e153 100644 --- a/src/store/flowStore.ts +++ b/src/store/flowStore.ts @@ -54,6 +54,7 @@ export default function flowStore( actions: { setElements(elements) { const { nextNodes, nextEdges } = parseElements(elements, this.nodes, this.edges, this.nodeExtent) + this.elements = elements this.nodes = nextNodes this.edges = nextEdges }, diff --git a/src/store/index.ts b/src/store/index.ts index 0aaed1a7..59065db8 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -75,6 +75,7 @@ export const initialState = (): FlowState => ({ isReady: false, hooks: createHooks(), storageKey: undefined, + instance: undefined, vueFlowVersion: typeof __VUE_FLOW_VERSION__ !== 'undefined' ? __VUE_FLOW_VERSION__ : '-', }) diff --git a/src/types/store.ts b/src/types/store.ts index 74c82005..3589066f 100644 --- a/src/types/store.ts +++ b/src/types/store.ts @@ -1,5 +1,16 @@ import { Store } from 'pinia' -import { Dimensions, ElementId, Elements, FlowOptions, Rect, SelectionRect, SnapGrid, Transform, XYPosition } from './types' +import { + Dimensions, + ElementId, + Elements, + FlowInstance, + FlowOptions, + Rect, + SelectionRect, + SnapGrid, + Transform, + XYPosition, +} from './types' import { HandleType } from './handle' import { ConnectionMode, OnConnectEndFunc, OnConnectFunc, OnConnectStartFunc, OnConnectStopFunc } from './connection' import { Edge, EdgeType } from './edge' @@ -57,6 +68,7 @@ export interface FlowState extends FlowOptions { isReady: boolean hooks: FlowHooks storageKey?: string + instance?: FlowInstance } export interface FlowGetters {