chore(core): cleanup useVueFlow

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-05 23:44:57 +01:00
parent 64e9dc3c1e
commit 1448543993

View File

@@ -137,11 +137,15 @@ export default (options?: FlowProps): VueFlowStore => {
if (isParentScope) {
// dispose of state values and storage entry
tryOnScopeDispose(() => {
if (storage.get(vueFlow!.id)) {
vueFlow!.$destroy()
}
if (vueFlow) {
const storedInstance = storage.get(vueFlow.id)
vueFlow = null
if (storedInstance) {
storedInstance.$destroy()
} else {
warn(`No store instance found for id ${vueFlow.id} in storage.`)
}
}
})
}
}