Skip to content

Latest commit

 

History

History
286 lines (183 loc) · 14.6 KB

CHANGELOG.md

File metadata and controls

286 lines (183 loc) · 14.6 KB

0.5.4 (2021-08-16)

Bug Fixes

  • nuxt: make $nuxt non enumerable (df75778), closes #574

Features

  • nuxt: resolve in mono repos (4716b5e)

0.5.3 (2021-08-02)

Bug Fixes

  • 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)

Bug Fixes

  • types: fix extension for TS 4.3 (e46f4b8)

0.5.1 (2021-05-17)

Bug Fixes

  • type: export forgotten types (b3909c7)
  • types: correct subtype Store (65d4ab3), closes #500

0.5.0 (2021-05-17)

Bug Fixes

  • types: forbid non existent keys on store (9513d1a)
  • types: patch should unwrap refs (9668167)
  • types: unwrap refs passed to state (c29b1e0), closes #491

Features

  • types: allow defining custom state properties (34cef9b)
  • subscribe to actions with $onAction (57d8503), closes #240

BREAKING CHANGES

  • The type property of the first parameter of store.$subscribe() has slightly changed. In most scenarios this shouldn't affect you as the possible values for type 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, the storeName property has been deprecated in favor of storeId (This is not really a breaking change yet).

0.4.1 (2021-05-05)

Bug Fixes

  • nuxt: inject Vue before rendering (309bf8f), closes #473

0.4.0 (2021-05-03)

Features

  • 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)

Performance Improvements

  • store: reuse stores from parent to children components (fcfda41)

BREAKING CHANGES

  • 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 just pinia:

    // replace
    pinia.use((pinia) => {})
    // with
    pinia.use(({ pinia, store }) => {})

    Check the new documentation for Plugins!

0.3.1 (2021-04-10)

Bug Fixes

  • store: avoid multiple subscriptions call (60df4d5), closes #429 #430
  • subscribe: remove subscription when unmounted (455ad95)

0.3.0 (2021-04-09)

Bug Fixes

  • types: enable autocomplete in object (5012611)

Features

0.2.5 (2021-04-01)

Features

  • allow passing a function to $patch (3be1c81)
  • types: generic on PiniaCustomProperties (9fedc04)

0.2.4 (2021-03-31)

Bug Fixes

  • nuxt: automatically transpile pinia (7c03691)

0.2.3 (2021-03-31)

Bug Fixes

  • 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.

Bug Fixes

  • use inject in nuxt plugin (d768a43)

0.2.1 (2021-03-23)

Bug Fixes

0.2.0 (2021-03-08)

Bug Fixes

  • only set state provider if a state exists (#248) (3634847)
  • outlive components lifespan (8516c48), closes #370

Continuous Integration

Features

  • nuxt: add buildModule (b1566f7)
  • nuxt: expose nuxt context as $nuxt (73c48be)
  • add PiniaPlugin (b3db04a)
  • deprecate createStore in favor of defineStore (76c3f95)

BREAKING CHANGES

  • 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 to useStore(pinia) when called outside of a setup() function. Check the SSR section of the docs for more details.

  • setActiveReq() and getActiveReq() have been replaced with setActivePinia() and getActivePinia() respectively. setActivePinia() can only be passed a pinia instance created with createPinia().

  • Since req as a parameter was replaced with pinia, getRootState is no longer necessary. Replace it with pinia.state.value to read and write the root state`.

  • PiniaSsr is no longer necessary and has been removed.

0.1.0 (2020-09-22)

Features

  • access the state and getters through this (#190) (7bb7733)

BREAKING CHANGES

  • there is no longer a state property on the store, you need to directly access it. getters no longer receive parameters, directly call this.myState to read state and other getters

0.0.7 (2020-07-13)

Bug Fixes

  • make pinia work with nuxt Composition API plugin (#180) (f4e2583), closes #179

0.0.6 (2020-05-25)

Bug Fixes

Features

0.0.5 (2020-01-20)

Bug Fixes

  • bind the actions to the store (5e262da)

Features

  • 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)

Bug Fixes

  • loose TS type for StateTree (092f169), closes #47

0.0.3 (2019-12-31)

Bug Fixes

  • global vueCompositionApi name (a23acef)

0.0.1 (2019-11-26)

Features