vuejs/vuex
🗃️ Centralized State Management for Vue.js.
30 Releases
Latest: 4y ago
v4.0.2Latest
🐛 Bug Fixes
- devtools: fix no getters displayed on root module + better getters inspector ([#1986](https://github.com/vuejs/vuex/issues/1986)) ([bc20295](https://github.com/vuejs/vuex/commit/bc20295331eb2bee40d6ae779d1ada31c542604c))
- build: cjs build failing due to `__VUE_PROD_DEVTOOLS__` defined ([#1991](https://github.com/vuejs/vuex/issues/1991)) ([#1992](https://github.com/vuejs/vuex/issues/1992)) ([7151622](https://github.com/vuejs/vuex/commit/7151622d646968686546f1c4c80f7575c9b99176))
v4.0.1
✨ Features
- dx: add devtools integration ([#1949](https://github.com/vuejs/vuex/pull/1949))
v4.0.0
📝 Documentation
- To check out docs, visit [next.vuex.vuejs.org](https://next.vuex.vuejs.org/).
📋 Installation process has changed
- To align with the new Vue 3 initialization process, the installation process of Vuex has changed.
- To create a new store instance, users are now encouraged to use the newly introduced `createStore` function.
- ```js
- import { createStore } from 'vuex'
- export const store = createStore({
- state() {
- return {
- count: 1
- + 14 more
📦 Bundles are now aligned with Vue 3
- The following bundles are generated to align with Vue 3 bundles:
- `vuex.global(.prod).js`
- For direct use with `<script src="...">` in the browser. Exposes the Vuex global.
- Global build is built as IIFE, and not UMD, and is only meant for direct use with `<script src="...">`.
- Contains hard-coded prod/dev branches and the prod build is pre-minified. Use the `.prod.js` files for production.
- `vuex.esm-browser(.prod).js`
- For use with native ES module imports (including module supporting browsers via `<script type="module">`.
- `vuex.esm-bundler.js`
- + 5 more
📦 Typings for `ComponentCustomProperties`
- Place the following code in your project to allow `this.$store` to be typed correctly:
- ```ts
- // vuex-shim.d.ts
- import { ComponentCustomProperties } from 'vue'
- import { Store } from 'vuex'
- declare module '@vue/runtime-core' {
- // Declare your own store states.
- interface State {
- + 7 more
📦 `createLogger` function is exported from the core module
- In Vuex 3, `createLogger` function was exported from `vuex/dist/logger` but it's now included in the core package. You should import the function directly from `vuex` package.
- ```js
- import { createLogger } from 'vuex'
- ```
🐛 Bug Fixes Included Since 4.0.0-rc.2
- export missing `storeKey` ([4ab2947](https://github.com/vuejs/vuex/commit/4ab294793a2c20ea6040f01f316618682df61fff))
- fix tree shaking notworking in webpack bundle ([#1906](https://github.com/vuejs/vuex/issues/1906)) ([#1907](https://github.com/vuejs/vuex/issues/1907)) ([aeddf7a](https://github.com/vuejs/vuex/commit/aeddf7a7c618eda7f316f8a6ace8d21eb96c29ff))
v3.6.2
🐛 Bug Fixes
- build: fix wrong path name for the export module ([679313b](https://github.com/vuejs/vuex/commit/679313bf5e4de066f340a06ef9bfe08d1536fadd))
v3.6.1
🐛 Bug Fixes
- fix tree shaking notworking in webpack bundle ([#1906](https://github.com/vuejs/vuex/issues/1906)) ([1dc2d1f](https://github.com/vuejs/vuex/commit/1dc2d1f21de42138053ea3281dde05487642a76d))
v4.0.0-rc.2
🐛 Bug Fixes
- fix getters stop working when component is destroyed ([#1884](https://github.com/vuejs/vuex/issues/1884)) ([c3a695e](https://github.com/vuejs/vuex/commit/c3a695e10682ab1b7288e72669861c9ca959df76))
- stop throwing an error on `hasModule` when parent does not exists ([#1850](https://github.com/vuejs/vuex/issues/1850)) ([f76d72d](https://github.com/vuejs/vuex/commit/f76d72d6c1f7cd30de9d459e23c371890c56f463))
✨ Features
- build: enable named esm module import on node.js >= 14 ([4f4a909](https://github.com/vuejs/vuex/commit/4f4a9096b46aa61580c32371adb19445157ba80c))
v3.6.0
🐛 Bug Fixes
- stop throwing an error on `hasModule` when parent does not exists ([#1850](https://github.com/vuejs/vuex/issues/1850)) ([#1851](https://github.com/vuejs/vuex/issues/1851)) ([12aabe4](https://github.com/vuejs/vuex/commit/12aabe4cc470916d40691097dcb95badb8212f5c))
✨ Features
- types: adding logger type for logger plugin ([#1853](https://github.com/vuejs/vuex/issues/1853)) ([cb3198d](https://github.com/vuejs/vuex/commit/cb3198d5998bdb11ef05dfa5ef98d5c5fa873089))
- build: enable named esm module import on node.js >= 14 ([#1872](https://github.com/vuejs/vuex/issues/1872)) ([acddab2](https://github.com/vuejs/vuex/commit/acddab20769d1bb6125f2da78ac47561c682fc98))
v4.0.0-rc.1
🐛 Bug Fixes
- fix getters getting re-evaluated on every access ([#1823](https://github.com/vuejs/vuex/issues/1823)) ([#1860](https://github.com/vuejs/vuex/issues/1860)) ([0006765](https://github.com/vuejs/vuex/commit/0006765ca3c5641ef732bad9df58e01f05c6f19c))
- types: add lost argument of useStore ([#1803](https://github.com/vuejs/vuex/issues/1803)) ([657afe3](https://github.com/vuejs/vuex/commit/657afe3db42c8d1d721216955fc2be3132e9fe6c))
✨ Features
- types: adding logger type for logger plugin ([#1853](https://github.com/vuejs/vuex/issues/1853)) ([cb3198d](https://github.com/vuejs/vuex/commit/cb3198d5998bdb11ef05dfa5ef98d5c5fa873089))
v4.0.0-beta.4Pre-release
🐛 Bug Fixes
- types: add missing `logger.d.ts` file to the package ([#1789](https://github.com/vuejs/vuex/issues/1789)) ([a477334](https://github.com/vuejs/vuex/commit/a477334b909913f6a92bdbedcf4a3016a62eab7a))
- warn when unregistering non existing module ([#1786](https://github.com/vuejs/vuex/issues/1786)) ([7cec79d](https://github.com/vuejs/vuex/commit/7cec79d339b874ec41f35891c891dfd27460c1d3))
v4.0.0-beta.3Pre-release
🐛 Bug Fixes
- UMD bundle containing `process.env` flag ([#1749](https://github.com/vuejs/vuex/issues/1749)) ([0fea8c4](https://github.com/vuejs/vuex/commit/0fea8c44060d08b3b421f1ddaa809fdffbc89b00))
✨ Features
- include `createLogger` function in core export ([afa566d](https://github.com/vuejs/vuex/commit/afa566d7f7b8e516389463b437fbfcb9eafdbd1b))
v3.5.1
🐛 Bug Fixes
- types: add missing `logger.d.ts` file to the package ([#1789](https://github.com/vuejs/vuex/issues/1789)) ([a477334](https://github.com/vuejs/vuex/commit/a477334b909913f6a92bdbedcf4a3016a62eab7a))
- warn when unregistering non existing module ([#1786](https://github.com/vuejs/vuex/issues/1786)) ([7cec79d](https://github.com/vuejs/vuex/commit/7cec79d339b874ec41f35891c891dfd27460c1d3))
v3.5.0
✨ Features
- include logger plugin to the core export ([#1783](https://github.com/vuejs/vuex/issues/1783)) ([04e2bd8](https://github.com/vuejs/vuex/commit/04e2bd8b3509c67398a6fe73a3d53660069feca8))
4.0.0-beta.2Pre-release
🐛 Bug Fixes
- types: add `useStore` function ([#1736](https://github.com/vuejs/vuex/issues/1736)) [#1739](https://github.com/vuejs/vuex/issues/1736)
- build: fix `iife` build containing `process.env`.
v3.4.0
✨ Features
- Allow action subscribers to catch rejections. ([#1740](https://github.com/vuejs/vuex/issues/1740)) ([6ebbe64](https://github.com/vuejs/vuex/commit/6ebbe64c5821d19e55a41dc8b1d81cfce6cbd195)), closes [#1489](https://github.com/vuejs/vuex/issues/1489) [#1558](https://github.com/vuejs/vuex/issues/1558) [#1625](https://github.com/vuejs/vuex/issues/1625)
v4.0.0-beta.1Pre-release
✨ Features
- Added TypeScript support.
💥 Breaking Changes
- The bundles are generated as below to align with Vue 3 bundles.
- `vuex.global(.prod).js`
- For direct use via `<script src="...">` in the browser. Exposes the Vuex global.
- Note that global builds are not UMD builds. They are built as IIFEs and is only meant for direct use via `<script src="...">`.
- Contains hard-coded prod/dev branches, and the prod build is pre-minified. Use the `.prod.js` files for production.
- `vuex.esm-browser(.prod).js`
- For usage via native ES modules imports (in browser via `<script type="module">`.
- `vuex.esm-bundler.js`
- + 18 more
v3.3.0
🐛 Bug Fixes
- Prepend devtool handler ([#1358](https://github.com/vuejs/vuex/issues/1358)) ([a39d076](https://github.com/vuejs/vuex/commit/a39d0767e4041cdd5cf8050774106c01d39024e0)), closes [vuejs/vue-devtools#678](https://github.com/vuejs/vue-devtools/issues/678)
- types: Add `devtools` to store options type ([#1478](https://github.com/vuejs/vuex/issues/1478)) ([38c11dc](https://github.com/vuejs/vuex/commit/38c11dcbaea7d7e661a1623cabb5aef7c6e47ba7))
✨ Features
- Add `prepend` option for `subscribe` and `subscribeAction` ([#1358](https://github.com/vuejs/vuex/issues/1358)) ([a39d076](https://github.com/vuejs/vuex/commit/a39d0767e4041cdd5cf8050774106c01d39024e0))
- logger: `createLogger` can optionally log actions ([#987](https://github.com/vuejs/vuex/issues/987)) ([18be128](https://github.com/vuejs/vuex/commit/18be128ad933d1fca6da05c060f7664ce0c819ae))
v3.2.0
✨ Features
- add Store#hasModule(path) API ([#834](https://github.com/vuejs/vuex/issues/834)) ([d65d142](https://github.com/vuejs/vuex/commit/d65d14276e87aca17cfbd3fbf4af9e8dbb808f24))
v4.0.0-alpha.1Pre-release
📦 Status: Alpha
- All Vuex 3 feature works. There are a few breaking changes described in a later section, so please check them out. You can find basic usage with both option and composition API at `example` folder.
📋 Installation process has changed
- To align with the new Vue 3 initialization process, the installation process of Vuex has changed as well.
- You should use a new `createStore` function to create a new store instance.
- ```js
- import { createStore } from 'vuex'
- const store = createStore({
- state () {
- return {
- count: 1
- + 13 more
📦 Kown issues
- The code is kept as close to Vuex 3 code base as possible, and there're plenty of places where we should refactor. However, we are waiting for all of the test cases to pass before doing so (some tests require Vue 3 update).
- TypeScript support is not ready yet. Please use JS environment to test this for now.
v3.1.3
🐛 Bug Fixes
- Prevent invalidating subscription iterator (#1438) (@cngu)
📦 Improvements
- Add vue as a peer dependency (#1692) (@kiaking)
v3.1.2
🐛 Bug Fixes
- types: avoid broadening vue instance type when using map helpers ([#1639](https://github.com/vuejs/vuex/issues/1639)) ([9a96720](https://github.com/vuejs/vuex/commit/9a96720)) (@ktsn)
📦 Improvements
- warn when the different namespaced modules has the same namespace ([#1554](https://github.com/vuejs/vuex/issues/1554)) ([91f3e69](https://github.com/vuejs/vuex/commit/91f3e69)) (@liyangworld)
- warn when mapXXX helpers receives an invalid parameter [#1093](https://github.com/vuejs/vuex/issues/1093) ([#1297](https://github.com/vuejs/vuex/issues/1297)) ([e5ca2d5](https://github.com/vuejs/vuex/commit/e5ca2d5)) (@EdyHartono)
- warn when registered module conflicts with existing parent module state ([#1365](https://github.com/vuejs/vuex/issues/1365)) ([538ee58](https://github.com/vuejs/vuex/commit/538ee58)) (@simplesmiler)
⚡ Performance Improvements
- cache `getters` object in an action context of a namespaced module ([#1546](https://github.com/vuejs/vuex/issues/1546)) ([4003382](https://github.com/vuejs/vuex/commit/4003382)) (@frankcs)
v3.1.1
📋 Changes
- Support for debugging Vuex in a [NativeScript](https://nativescript-vue.org/) application with the [standalone Vue Devtools app](https://github.com/vuejs/vue-devtools/tree/dev/shells/electron) (#1404)
- New ES modules build for browser (#1533): [vuex.esm.browser.js](https://github.com/vuejs/vuex/blob/dev/dist/vuex.esm.browser.js) and [vuex.esm.browser.min.js](https://github.com/vuejs/vuex/blob/dev/dist/vuex.esm.browser.min.js)
- Improved jsdelivr support (#1496)
- Memory leak happening while using registerModule/unregisterModule (#1508)
- Typings: Make mutation and action payload optional in definition file (#1517)
v3.1.0
✨ Features
- `store.subscribeAction` can now specify whether the handler should be invoked before the action, after the action, or both. 76818c1 (#1115 by @wa3l)
📦 Improvements
- Errors thrown inside action subscribers no longer cause the entire action to fail.
v3.0.1
🐛 Fixed
- Type compatibility with TypeScript 2.6
v3.0.0
💥 Breaking Changes
- > This major release only breaks backwards compatibility if you use TypeScript.
- TypeScript type declarations have been updated to be compatible with Vue core 2.5+ and no longer work with 2.4 and below.
- All type declarations are now exported using ES-style exports, and must be imported using ES modules syntax:
- ``` js
- import { Store } from 'vuex'
- ```
v2.5.0
✨ New
- `store.registerModule` can now be called while preserving current state if the module is already registered, by passing a 3rd argument as `{ preserveState: true }`. Useful in server-side rendering.
- New method: `store.subscribeAction()` - similar to `store.subscribe`, but for actions instead.
- Namespaced modules can now also register global actions using the following syntax:
- ``` js
- const module = {
- actions: {
- rootAction: {
- root: true,
- + 6 more
v2.4.1
🐛 Fixed
- Allow installation on different copies of Vue for testing purposes
- Fix #731 by moving auto installation code into the store constructor (#914)
v2.4.0
✨ New
- New helper method `createNamespacedHelpers`: a helper-generator that generates namespaced `mapXXX` helpers for you:
- ``` js
- const { mapState, mapActions } = createNamespacedHelpers('some/nested/module')
- // everything generated by mapState and mapActions are bound to the module.
- ```
- See [docs](https://vuex.vuejs.org/en/modules.html#binding-helpers-with-namespace) for more info.
- (@riophae via #800)
📦 Misc
- Various typing and assertion improvements.
v2.3.0
📋 Changes
- Modules can now declare `state` using a function - this allows the same module definition to be reused (e.g. multiple times in the same store, or in multiple stores)
v2.2.0
📋 Changes
- Now exposes ES module build by default for webpack 2 and rollup.
v2.1.2
🐛 Fixed
- #524 avoid firing unrelated watchers when calling `registerModule` (@ktsn)
- #528 ensure module local state always refers to actual state (@ktsn)