Skip to content

Latest commit

 

History

History
217 lines (137 loc) · 10.7 KB

CHANGELOG.md

File metadata and controls

217 lines (137 loc) · 10.7 KB

2.0.0-alpha.16 (2021-05-04)

Bug Fixes

Features

  • devtools: display getters in components (810b969)

2.0.0-alpha.15 (2021-05-04)

Bug Fixes

  • devtools: fix devtools attach (017795a)

2.0.0-alpha.14 (2021-05-03)

Features

  • devtools: work with stores added before app.use (#444) (21f917f)
  • devtools: add getters to devtools (c4bf761)
  • mark getters as readonly (fcbeb95)
  • plugins: allow chaining (3a49d34)
  • mapHelpers: warn on array mapStores (d385bd9)
  • pass options to context in plugins (c8ad19f)
  • types: expose PiniaPluginContext (94d12e7)
  • add plugin api wip (50bc807)
  • plugins: allow void return (5ef7140)
  • plugins: pass a context object to plugins instead of app (bcb4ec3)
  • add plugin api wip (b5c928d)

Performance Improvements

  • store: reuse store instances when possible (14f5a5f)

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 explicitly 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 app:

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

    Check the new documentation for Plugins!

2.0.0-alpha.13 (2021-04-10)

Bug Fixes

  • subscribe: remove subscription when unmounted (10e1c30)

Features

  • types: fail on async patch (c254a8a)

2.0.0-alpha.12 (2021-04-09)

Bug Fixes

2.0.0-alpha.11 (2021-04-09)

Bug Fixes

  • types: enable autocomplete in object (b299ff0)

Features

2.0.0-alpha.10 (2021-04-01)

Features

  • patch: allow passing a function (8d545e4)
  • types: generics on PiniaCustomProperties (36129cf)

2.0.0-alpha.9 (2021-03-31)

Bug Fixes

  • types: pass custom properties to stores (d26df6e)

2.0.0-alpha.8 (2021-03-29)

Bug Fixes

  • use assign instead of spread (b2bb5ba)
  • cjs: ensure dev checks on cjs build (a255735)

Features

  • devtools: logo and titles (0963fd0)

2.0.0-alpha.7 (2021-01-21)

Bug Fixes

Features

  • enable calling useStore() in client (c949b80)
  • store plugins (f027bf5)

2.0.0-alpha.6 (2020-12-31)

Bug Fixes

Features

BREAKING CHANGES

  • setActiveReq() has been renamed to setActivePinia(). And now receives the application's pinia as the first parameter instead of an arbitrary object (like a Node http request). This affects particularly users doing SSR but also enables them to write universal code.

2.0.0-alpha.5 (2020-10-09)

Code Refactoring

BREAKING CHANGES

  • all store properties (id, state, patch, subscribe, and reset) are now prefixed with $ to allow properties defined with the same type and avoid types breaking. Tip: you can refactor your whole codebase with F2 (or right-click + Refactor) on each of the store's properties

2.0.0-alpha.4 (2020-09-29)

Bug Fixes

  • detach stores creation from currentInstance (dc31736)

2.0.0-alpha.3 (2020-09-28)

Code Refactoring

  • rename createStore to defineStore (a9ad160)

Features

  • deprecation message createStore (3054251)
  • ssr: support ssr (59709e0)

BREAKING CHANGES

  • renamed createStore to defineStore. createStore will be marked as deprecated during the alpha releases and then be dropped.

2.0.0-alpha.2 (2020-09-25)

Features

2.0.0-alpha.1 (2020-09-22)

Features

  • access the state and getters through this (#190) (6df18ef)
  • merge all properties under this (d5eaac1)

BREAKING CHANGES

  • state properties no longer need to be accessed through store.state
  • getters no longer receive parameters, access the store instance via this: directly call this.myState to read state and other getters. Update 2021-04-02: getters receive the state again as the first parameter