import { DevtoolHook, StateTree, StoreWithState } from './types'
+import { assign } from './utils'
const target =
typeof window !== 'undefined'
rootStore.state[store.$id] = state
devtoolHook.emit(
'vuex:mutation',
- {
- ...mutation,
- type: `[${mutation.storeName}] ${mutation.type}`,
- },
+ assign({},
+ mutation,
+ {type: `[${mutation.storeName}] ${mutation.type}`,
+ }),
rootStore.state
)
})
PiniaCustomProperties,
piniaSymbol,
} from './rootStore'
+import { assign } from './utils'
const isClient = typeof window != 'undefined'
}
const extensions = pinia._p.reduce(
- (extended, extender) => ({
- ...extended,
- ...extender(),
- }),
+ (extended, extender) => assign({}, extended, extender()),
{} as PiniaCustomProperties
)
- const store: Store<Id, S, G, A> = reactive({
- ...extensions,
- ...partialStore,
- // using this means no new properties can be added as state
- ...computedFromState(pinia.state, $id),
- ...computedGetters,
- ...wrappedActions,
- }) as Store<Id, S, G, A>
+ const store: Store<Id, S, G, A> = reactive(
+ assign(
+ {},
+ extensions,
+ partialStore,
+ // using this means no new properties can be added as state
+ computedFromState(pinia.state, $id),
+ computedGetters,
+ wrappedActions
+ )
+ ) as Store<Id, S, G, A>
// use this instead of a computed with setter to be able to create it anywhere
// without linking the computed lifespan to wherever the store is first