Upgrading pinia 3 to 4
Breaking3.0.4 → 4.1.0Breaking2New4Changed4Fixed13Other2
BreakingUpgrade verdict
2 breaking changes.
In plain terms
- The package can no longer be loaded with CommonJS require; you must use ES modules.
- You now need to install @vue/devtools-api yourself in addition to pinia.
Must act 2 items need code or config changes
Adds nostics ^1.2.0.
Drops @vue/devtools-api.
Installs 1 package in all (was 11).
No longer installs @vue/devtools-kit, @vue/devtools-shared, birpc, copy-anything, hookable, mitt, perfect-debounce, rfdc, speakingurl, superjson.
What you must change
Breaking2
Pinia 4 is ESM only.
Upgrades @vue/devtools-api to v8, which must now be installed alongside pinia.
@vue/devtools-apiAPI changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- removed:
interface ComponentOptions<V> - removed:
property ComponentOptions.pinia?: Pinia
- removed:
interface Vue - removed:
property Vue.$pinia: Pinia - removed:
property Vue._pStores?: Record<string, Store>
- removed:
declare module 'vue/types/options' - removed:
declare module 'vue/types/vue' - changed:
function defineStore<Id extends string, SS>(id: Id, storeSetup: (helpers: SetupStoreHelpers) => SS, options?: DefineSetupStoreOptions<Id, _ExtractStateFromSetupStore<SS>, _ExtractGettersFromSetupStore<SS>, _ExtractActionsFromSetupStore<SS>>): StoreDefinition<Id, _ExtractStateFromSetupStore<SS>, _ExtractGettersFromSetupStore<SS>, _ExtractActionsFromSetupStore<SS>> → function defineStore<Id extends string, SS>(id: Id, storeSetup: (helpers: SetupStoreHelpers) => SS, options?: DefineSetupStoreOptions<Id, _ExtractStateFromSetupStore<SS>, _ExtractGettersFromSetupStore<SS>, _ExtractActionsFromSetupStore<SS>>): SetupStoreDefinition<Id, SS> - changed:
type _MapStateObjectReturn<Id extends string, S extends StateTree, G extends _GettersTree<S> | { [key: string]: ComputedRef }, A, T extends Record<string, keyof S | keyof G | ((store: Store<Id, S, G, A>) => any)> = {}> = { [key in keyof T]: () => T[key] extends (store: any) => infer R ? R : T[key] extends keyof Store<Id, S, G, A> ? Store<Id, S, G, A>[T[key]] : never } → type _MapStateObjectReturn<Id extends string, S extends StateTree, G extends _GettersTree<S> | { [key: string]: ComputedRef }, A, T extends Record<string, keyof S | keyof G | ((store: Store<Id, S, G, A>) => any)> = {}> = { [key in keyof T]: () => T[key] extends ((store: any) => infer R) ? R : T[key] extends keyof Store<Id, S, G, A> ? Store<Id, S, G, A>[T[key]] : never } - changed:
type _StoreWithActions<A> = { [k in keyof A]: A[k] extends (...args: infer P) => infer R ? (...args: P) => R : never } → type _StoreWithActions<A> = { [k in keyof A]: A[k] extends ((...args: infer P) => infer R) ? (...args: P) => R : never } - added:
const piniaSymbol: InjectionKey<Pinia> - added:
function getStores(pinia: Pinia): StoreGeneric[] - added:
method StoreProperties._hotUpdate(useStore: StoreGeneric): void - added:
property Pinia._a: App - added:
property Pinia._e: EffectScope - added:
property Pinia._p: PiniaPlugin[] - added:
property Pinia._s: Map<string, StoreGeneric> - added:
property Pinia._testing?: boolean - added:
property StoreDefinition._pinia?: Pinia - added:
property StoreProperties._getters?: string[] - added:
property StoreProperties._hmrPayload: { state: string[]; stateKeys: Record<string, string[]>; hotState: Ref<StateTree>; actions: _ActionsTree; getters: _ActionsTree } - added:
property StoreProperties._hotUpdating: boolean - added:
property StoreProperties._isOptionsAPI?: boolean - added:
property StoreProperties._p: Pinia