0.5.4 (2021-08-16)
- nuxt: resolve in mono repos (4716b5e)
0.5.3 (2021-08-02)
- markRaw on pinia (208e6c0)
- patch: avoid merging reactive objects (581bd08), closes #528
- types: forbid non existent access in getters and actions (29eee8a)
- types: remove state properties from this (7990adf)
0.5.2 (2021-06-03)
- types: fix extension for TS 4.3 (e46f4b8)
0.5.1 (2021-05-17)
0.5.0 (2021-05-17)
- types: forbid non existent keys on store (9513d1a)
- types: patch should unwrap refs (9668167)
- types: unwrap refs passed to state (c29b1e0), closes #491
- types: allow defining custom state properties (34cef9b)
- subscribe to actions with
$onAction
(57d8503), closes #240
-
The
type
property of the first parameter ofstore.$subscribe()
has slightly changed. In most scenarios this shouldn't affect you as the possible values fortype
were including emojis (a bad decision...) and they are now using an enum without emojis. Emojis are used only in devtools to give a mental hint regarding the nature and origin of different events in the timeline. -
In
store.$subscribe()
's first argument, thestoreName
property has been deprecated in favor ofstoreId
(This is not really a breaking change yet).
0.4.1 (2021-05-05)
0.4.0 (2021-05-03)
- pinia: allow chaining pinia.use (d5e7a6e)
- plugins: pass a context object to plugins instead of app (8176db4)
- plugins: pass options to plugins (4d750ad)
- store: pass state to getters as first argument (9f3132b)
- types: fail on async patch (fe58fab)
- store: reuse stores from parent to children components (fcfda41)
-
store: getters now receive the state as their first argument and it's properly typed so you can write getters with arrow functions:
defineStore({ state: () => ({ n: 0 }), getters: { double: (state) => state.n * 2, }, })
To access other getters, you must still use the syntax that uses
this
but it is now necessary to explicitely type the getter return type. The same limitation exists in Vue for computed properties and it's a known limitation in TypeScript:defineStore({ state: () => ({ n: 0 }), getters: { double: (state) => state.n * 2, // the `: number` is necessary when accessing `this` inside of // a getter doublePlusOne(state): number { return this.double + 1 }, }, })
For more information, refer to the updated documentation for getters.
-
plugins: To improve the plugin api capabilities,
pinia.use()
now receives a context object instead of justpinia
:// replace pinia.use((pinia) => {}) // with pinia.use(({ pinia, store }) => {})
Check the new documentation for Plugins!
0.3.1 (2021-04-10)
- store: avoid multiple subscriptions call (60df4d5), closes #429 #430
- subscribe: remove subscription when unmounted (455ad95)
0.3.0 (2021-04-09)
- types: enable autocomplete in object (5012611)
- mapWritableState (6eb04da)
- mapState: accept functions (6e09db6)
- mapStores: allow custom suffix (633dbb1)
- types: allow extending mapStores suffix (90a0326)
- add mapActions (32c28e3)
- add mapStores (ac20f59)
- mapState with array (41a7ad0)
- mapState with object (a4eb4af)
0.2.5 (2021-04-01)
0.2.4 (2021-03-31)
- nuxt: automatically transpile pinia (7c03691)
0.2.3 (2021-03-31)
- types: add PiniaCustomProperties to stores (a12d96d)
- types: pass custom properties to actions and getters (6a5326f)
0.2.2 (2021-03-31)
This build exposes the exports
option in package.json
, please report any errors you find.
- use inject in nuxt plugin (d768a43)
0.2.1 (2021-03-23)
0.2.0 (2021-03-08)
- only set state provider if a state exists (#248) (3634847)
- outlive components lifespan (8516c48), closes #370
- add size check (df59e90)
- nuxt: add buildModule (b1566f7)
- nuxt: expose nuxt context as $nuxt (73c48be)
- add PiniaPlugin (b3db04a)
- deprecate createStore in favor of defineStore (76c3f95)
-
files in dist folder are renamed to match official libs in the Vue ecosystem. Unless you were importing from
pinia/dist
, this won't affect you. -
It's now necessary to create a pinia instance and install it:
import { createPinia, PiniaPlugin } from 'pinia' const pinia = createPinia() Vue.use(PiniaPlugin) new Vue({ el: '#app', pinia, // ... })
The
pinia
instance can be passed touseStore(pinia)
when called outside of asetup()
function. Check the SSR section of the docs for more details. -
setActiveReq()
andgetActiveReq()
have been replaced withsetActivePinia()
andgetActivePinia()
respectively.setActivePinia()
can only be passed apinia
instance created withcreatePinia()
. -
Since req as a parameter was replaced with
pinia
,getRootState
is no longer necessary. Replace it withpinia.state.value
to read and write the root state`. -
PiniaSsr
is no longer necessary and has been removed.
0.1.0 (2020-09-22)
- there is no longer a
state
property on the store, you need to directly access it.getters
no longer receive parameters, directly callthis.myState
to read state and other getters
0.0.7 (2020-07-13)
0.0.6 (2020-05-25)
0.0.5 (2020-01-20)
- bind the actions to the store (5e262da)
- add nuxt module (4c0ef7a)
- allow empty state option to make it easy to group stores (810e0f0)
- allow passing the req to useStore (f250622)
- allow useStore to be called within a store (fdf6b45)
- allow using getters in other getters (859eeb3)
- export types, support state hydration (89996ed)
- handle SSR state hydration (2998d53)
- state hydration (db72247)
0.0.4 (2020-01-09)
0.0.3 (2019-12-31)
- global vueCompositionApi name (a23acef)