})
it('can force the pinia', () => {
+ // setup other pinias to force possible override effects on the options effect
+ const pinia11 = createPinia()
+ // const pinia22 = createPinia()
+ setActivePinia(pinia11)
+ useA()
+ setActivePinia(undefined)
+
const pinia1 = createPinia()
const pinia2 = createPinia()
const aStore = useA(pinia1)
import { createPinia, defineSetupStore, defineStore } from '../src'
import { mount } from '@vue/test-utils'
-import { App, computed, Ref, ref, toRef } from 'vue'
+import { App, computed, ref, toRef } from 'vue'
declare module '../src' {
export interface PiniaCustomProperties<Id> {
import { setupDevtoolsPlugin, TimelineEvent } from '@vue/devtools-api'
import { App, ComponentPublicInstance, toRaw } from 'vue'
-import { Pinia, PiniaPluginContext, setActivePinia } from '../rootStore'
+import { Pinia, PiniaPluginContext } from '../rootStore'
import {
Store,
GettersTree,
for (const actionName in actions) {
// @ts-expect-error
store[actionName] = function () {
- setActivePinia(store._p)
+ // setActivePinia(store._p)
// the running action id is incremented in a before action hook
const _actionId = runningActionId
const trackedStore = new Proxy(store, {
// list actions so they can be used in plugins
// @ts-expect-error
- optionsForPlugin.actions[key] = setupStore[key] // TODO: check this change from `prop` is correct
+ optionsForPlugin.actions[key] = prop
} else if (__DEV__) {
// add getters for devtools
if (isComputed(prop)) {
}
// remove deleted getters
- console.log('remove', store._hmrPayload)
Object.keys(store._hmrPayload.getters).forEach((key) => {
- console.log('checking for', key)
if (!(key in newStore._hmrPayload.getters)) {
- console.log('deleting')
// @ts-expect-error
delete store[key]
}
// remove old actions
Object.keys(store._hmrPayload.actions).forEach((key) => {
- console.log('checking for', key)
if (!(key in newStore._hmrPayload.actions)) {
- console.log('deleting')
// @ts-expect-error
delete store[key]
}