-
Upgrade devDependencies.
-
Allow clear to delete all cached actions with same name.
Thanks to @lukasbesch for PR #51.
- Upgrade devDependencies.
- Rename
dist/vuex-cache.esm.js
todist/vuex-cache.es.js
because ofbili
update.
- Upgrade devDependencies.
-
Fixed
mapCacheActions
apply wrong context todispatch
method.Thanks to @kierans for PR #44 that fixed issue #43 reported by himself.
-
Export the
StoreCache
interface in type declarations.Thanks to @kierans for PR #42 that fixed issue #41 reported by himself.
-
Add
mapCacheAction
function helper to call actions with cache on components.import { mapCachedActions } from 'vuex-cache'; export default { name: 'Users', async mounted() { this.GET_USER(); this.FETCH_REPOSITORY(219, { timeout: 30000 }); } methods: { ...mapCachedActions(['FETCH_REPOSITORY']), ...mapCachedActions('user', ['GET_USER']) } }
-
Breaking Change: Module exports a factory to create plugin instead of the plugin itself.
import Vue from 'vue' import Vuex, { Store } from 'vuex' import createCache from 'vuex-cache' Vue.use(Vuex) const store = new Store({ plugins: [createCache()], ... })
-
Breaking Change:
store.cache.has()
returnsfalse
for expired actions.const store = new Store({ plugins: [createCache()], actions: { ACTION: () => {}, }, }) store.cache.has('ACTION') //=> false store.cache.dispatch('ACTION', undefined, { timeout: 100, }) store.cache.has('ACTION') //=> true setTimeout(() => { store.cache.has('ACTION') //=> false }, 100)
This fixes issue #28.
-
Breaking Change: Cache is module scoped and don't support multiple instances anymore.
This fixes an issue with
cacheAction
cache state different from plugin one. -
Breaking Change:
createCache
returnsThis fixes an issue with
cacheAction
cache state different from plugin one. -
Breaking Change: Rename main source module and bundles.
- Main module
index.js
is nowvuex-cache.js
- CommonJS bundle
dist/vuex-cache.cjs.js
is nowdist/vuex-cache.js
- ESM bundle
dist/vuex-cache.es.js
is nowdist/vuex-cache.mjs
- UMD bundle
dist/vuex-cache.js
is nowdist/vuex-cache.umd.js
- UMD minified bundle
dist/vuex-cache.min.js
is nowdist/vuex-cache.umd.min.js
- Main module
-
It now supports some of non JSON parseable values as arguments. Like functions,
undefined
and other values.This fixes issue #30.
-
It fallback dispatches to uncached if params have circular references.
This fixes issue #29.
-
Add JSDoc comments to functions and values.
-
Rename main module, functions and variables.
-
Refactor unit tests and split them into multiple modules.
-
Upgrade dependencies and bundle settings.
-
Create type definitions for TS developers & Editor/IDE intellisense.
This fixes issue #32.
-
Add MIT License.
-
Improve
README.md
docs.This fixes issue #21.
-
Add Installation on Nuxt.js section to
README.md
.This fixes issue #26.
-
Move
Map
polyfill notice to Compatibility section.Maybe fix the cause of issue #31.
-
Improve Installation section on
README.md
. -
Refactor Usage section and move it up.
-
Create API section with docs about
cache
methods, Payload and Timeout. -
Remove old docs about
cache
methods, payload and timeout. -
Change
package.json
description and keywords.
-
-
Improve documentation.
- Fix title on
README.md
; - Add
CHANGELOG
file. - Improve Compatibility, Installation sections and move them up on
README.md
.
This is part of a pretty big docs improvement suggested by @vjee on issue #21.
- Fix title on
-
Add @VitorLuizC to contributors on package.
-
Upgrade dependencies.
-
Remove unused
babel
,eslint
andjest
plugins. -
Improve bundle, test and lint
- Remove comments and unused env on
.eslintrc.js
. - Remove unused env and plugins on
babel.config.js
. - Delete
.eslintignore
file. - Enforce Yarn and on package scripts.
- Remove
npx
andNODE_ENV
assignment on package scripts.
- Remove comments and unused env on
-
Breaking Change: Actions that throw error, or that returns a promise rejection, will no longer be added to the cache.
'UPDATE_USER': async () => { // ... throw new Error('An unknown error.'); } }; await store.cache.dispatch('UPDATE_USER'); // throws Error: An unknown error. store.cache.has('UPDATE_USER'); //=> false
-
Exports
cacheAction
function, an action enhancer, to makecache
available on action context.import { cacheAction } from 'vuex-cache'; // ... 'UPDATE_CATEGORIES': cacheAction(({ commit, cache }, category) => { const categories = cache.dispatch('GET_CATEGORIES'); commit('CATEGORIES', [ ...categories, category ]); }) };
-
Use bili instead of own bundle script. It bundles ESM module down to ES5 and generates UMD and UMD + min modules.
-
Fix a typo on
README.md
.
-
Adds an option to define default timeout on actions.
timeout
option is optional and it's overwritten by action specifictimeout
.import Vuex, { Store } from 'vuex' import cache from 'vuex-cache' const store = new Vuex.Store({ plugins: [ cache({ timeout: 2000 }) ], ... })
Improvement suggested by @hvaughan3 on #11.
-
Add
timeout
option to dispatch options.store.cache.dispatch({ type: 'UPDATE_USER', param: payload, timeout: 100, }) // Or using dispatch's third argument (`DispatchOptions`). store.cache.dispatch('UPDATE_USER', payload, { timeout: 100, })
Improvement suggested by @razekteixeira on #11 and by @samsebastian on #4.
- Change build and tests:
- Update
babel
to version 7 and usebabel-env
; - Use
jest
instead ofmocha
andexpect
for unit tests; - Use rollup to generate ESM + ES6 bundle, besides the CommonJS + ES5 one.
- Update
- Fixe
cache.delete
function for actions with a payload.
-
Add support to cache actions with params/payloads.
store.cache.dispatch({ type: 'UPDATE_USER', param: payload, }) store.cache.dispatch('UPDATE_USER', payload)
-
Use a
Map
instance instead of own functions to check, delete and clean cache.This is added on PR #1.