update(store): try to get active pinia before using new one
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import microDiff from 'microdiff'
|
import microDiff from 'microdiff'
|
||||||
import { setActivePinia, createPinia, defineStore, StoreDefinition, acceptHMRUpdate } from 'pinia'
|
import { setActivePinia, createPinia, defineStore, StoreDefinition, acceptHMRUpdate, getActivePinia } from 'pinia'
|
||||||
import { FlowState, FlowActions, Elements, FlowGetters, GraphNode, GraphEdge } from '~/types'
|
import { FlowState, FlowActions, Elements, FlowGetters, GraphNode, GraphEdge } from '~/types'
|
||||||
import {
|
import {
|
||||||
getConnectedEdges,
|
getConnectedEdges,
|
||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
|
|
||||||
export default (id: string, preloadedState: FlowState) => {
|
export default (id: string, preloadedState: FlowState) => {
|
||||||
setActivePinia(pinia)
|
setActivePinia(getActivePinia() ?? pinia)
|
||||||
|
|
||||||
const store: StoreDefinition<string, FlowState, FlowGetters, FlowActions> = defineStore({
|
const store: StoreDefinition<string, FlowState, FlowGetters, FlowActions> = defineStore({
|
||||||
id: id ?? 'vue-flow',
|
id: id ?? 'vue-flow',
|
||||||
|
|||||||
Reference in New Issue
Block a user