setActivePinia(pinia)
// it was created just before
const store = pinia._s.get(id)!
+
+ // allow cross using stores
+ if (isVue2 && store._r) return
+
// @ts-expect-error
// return getters![name].call(context, context)
// TODO: avoid reading the getter while assigning with a global variable
$dispose,
} as StoreWithState<Id, S, G, A>
+ if (isVue2) {
+ // start as non ready
+ partialStore._r = false
+ }
+
const store: Store<Id, S, G, A> = reactive(
assign(
__DEV__ && IS_CLIENT
}
}
+ if (isVue2) {
+ // mark the store as ready before pluginsn
+ store._r = true
+ }
+
// apply all plugins
pinia._p.forEach((extender) => {
/* istanbul ignore else */
* e.g. devtools plugin stops displaying disposed stores from devtools.
*/
$dispose(): void
+
+ /**
+ * Vue 2 only. Is the store ready. Used for store cross usage. Getters automatically compute when they are added to
+ * the store, before the store is actually ready, this allows to avoid calling the computed function yet.
+ *
+ * @internal
+ */
+ _r?: boolean
}
/**