From: Eduardo San Martin Morote Date: Wed, 3 Nov 2021 14:18:45 +0000 (+0100) Subject: docs: list all deprecations X-Git-Tag: pinia@2.0.1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17173bb4a39cb3783b8af923d7c4186768fdf98a;p=thirdparty%2Fvuejs%2Fpinia.git docs: list all deprecations --- diff --git a/packages/docs/cookbook/migration-v1-v2.md b/packages/docs/cookbook/migration-v1-v2.md index a7fcb2d7..23a6239b 100644 --- a/packages/docs/cookbook/migration-v1-v2.md +++ b/packages/docs/cookbook/migration-v1-v2.md @@ -16,6 +16,9 @@ If you are using ESLint, consider using [this plugin](https://github.com/gund/es - `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 @@ -52,12 +55,28 @@ If you were writing plugins, using TypeScript, and extending the type `DefineSto - export interface DefineStoreOptions { + export interface DefineStoreOptionsBase { debounce?: { - [k in keyof A]?: number + [k in keyof StoreActions]?: 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`: diff --git a/packages/pinia/src/types.ts b/packages/pinia/src/types.ts index 31d192ac..1f0c25f3 100644 --- a/packages/pinia/src/types.ts +++ b/packages/pinia/src/types.ts @@ -359,7 +359,6 @@ export interface _StoreWithState< ): () => 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: