fix(core): avoid options passed to useVueFlow overwriting default state

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 3c288e643b
commit 04658b2c0d
4 changed files with 27 additions and 43 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import { toRefs, tryOnScopeDispose } from '@vueuse/core'
import type { EffectScope } from 'vue'
import { computed, effectScope, getCurrentScope, inject, provide, reactive, watch } from 'vue'
import type { EdgeChange, FlowOptions, FlowProps, NodeChange, State, VueFlowStore } from '../types'
import type { EdgeChange, FlowOptions, FlowProps, NodeChange, VueFlowStore } from '../types'
import { warn } from '../utils'
import { useActions, useGetters, useState } from '../store'
import { VueFlow } from '../context'
@@ -35,7 +35,7 @@ export class Storage {
}
public create(id: string, preloadedState?: FlowOptions): VueFlowStore {
const state: State = useState(preloadedState)
const state = useState()
const reactiveState = reactive(state)
@@ -58,7 +58,7 @@ export class Storage {
const actions = useActions(id, reactiveState, getters, nodeIds, edgeIds)
actions.setState(reactiveState)
actions.setState({ ...reactiveState, ...preloadedState })
const flow: VueFlowStore = {
...hooksOn,