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:
Braks
2021-12-04 15:42:18 +01:00
parent a66425294c
commit 58f5c2568c
+2 -2
View File
@@ -1,5 +1,5 @@
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 {
getConnectedEdges,
@@ -17,7 +17,7 @@ import {
const pinia = createPinia()
export default (id: string, preloadedState: FlowState) => {
setActivePinia(pinia)
setActivePinia(getActivePinia() ?? pinia)
const store: StoreDefinition<string, FlowState, FlowGetters, FlowActions> = defineStore({
id: id ?? 'vue-flow',