return target
}
-const skipHydrateSymbol = __DEV__ ? Symbol('pinia:skipHydration') : Symbol()
+const skipHydrateSymbol = __DEV__
+ ? Symbol('pinia:skipHydration')
+ : /* istanbul ignore next */ Symbol()
const skipHydrateMap = /*#__PURE__*/ new WeakMap<any, any>()
export function skipHydrate<T = any>(obj: T): T {
return isVue2
? // in @vue/composition-api, the refs are sealed so defineProperty doesn't work...
- skipHydrateMap.set(obj, 1) && obj
+ /* istanbul ignore next */ skipHydrateMap.set(obj, 1) && obj
: Object.defineProperty(obj, skipHydrateSymbol, {})
}
function shouldHydrate(obj: any) {
return isVue2
- ? skipHydrateMap.has(obj)
+ ? /* istanbul ignore next */ skipHydrateMap.has(obj)
: !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol)
}
function setup() {
if (!initialState && (!__DEV__ || !hot)) {
+ /* istanbul ignore if */
if (isVue2) {
set(pinia.state.value, id, state ? state() : {})
} else {
const store = pinia._s.get(id)!
// allow cross using stores
+ /* istanbul ignore next */
if (isVue2 && !store._r) return
// @ts-expect-error
// avoid setting the state for option stores are it is set
// by the setup
if (!buildState && !initialState && (!__DEV__ || !hot)) {
+ /* istanbul ignore if */
if (isVue2) {
set(pinia.state.value, $id, {})
} else {
$dispose,
} as _StoreWithState<Id, S, G, A>
+ /* istanbul ignore if */
if (isVue2) {
// start as non ready
partialStore._r = false
}
}
// transfer the ref to the pinia state to keep everything in sync
+ /* istanbul ignore if */
if (isVue2) {
set(pinia.state.value[$id], key, prop)
} else {
const actionValue = __DEV__ && hot ? prop : wrapAction(key, prop)
// this a hot module replacement store because the hotUpdate method needs
// to do it with the right context
+ /* istanbul ignore if */
if (isVue2) {
set(setupStore, key, actionValue)
} else {
}
// add the state, getters, and action properties
+ /* istanbul ignore if */
if (isVue2) {
Object.keys(setupStore).forEach((key) => {
set(
}
}
+ /* istanbul ignore if */
if (isVue2) {
// mark the store as ready before plugins
store._r = true