- `createStore()` becomes `defineStore()`
- In subscriptions, `storeName` becomes `storeId`
+- `PiniaPlugin` was renamed `PiniaVuePlugin` (Pinia plugin for Vue 2)
+- `$subscribe()` no longer accepts a _boolean_ as second parameter, pass an object with `detached: true` instead.
+- Pinia plugins no longer directly receive the `id` of the store. Use `store.$id` instead.
## Breaking changes
- export interface DefineStoreOptions<S, Store> {
+ export interface DefineStoreOptionsBase<S, Store> {
debounce?: {
- [k in keyof A]?: number
+ [k in keyof StoreActions<Store>]?: number
}
}
}
```
+## `PiniaStorePLugin` was renamed
+
+The type `PiniaStorePlugin` was renamed to `PiniaPlugin`
+
+```diff
+-import { PiniaStorePlugin } from 'pinia'
++import { PiniaPlugin } from 'pinia'
+
+-const piniaPlugin: PiniaStorePlugin = () => {
++const piniaPlugin: PiniaPlugin = () => {
+ // ...
+ }
+```
+
+**Note this change can only be done after upgrading to the latest version of Pinia without deprecations**.
+
## `@vue/composition-api` version
Since pinia now relies on `effectScope()`, you must use at least the version `1.1.0` of `@vue/composition-api`:
): () => void
/**
- * @alpha Please send feedback at https://github.com/posva/pinia/issues/240
* Setups a callback to be called every time an action is about to get
* invoked. The callback receives an object with all the relevant information
* of the invoked action: