Closed VitorLuizC closed 5 years ago
If you pass a payload with circular references to store.cache.dispatch it throws TypeError: Converting circular structure to JSON.
TypeError: Converting circular structure to JSON
This can be checked by running the code below.
import Vue from 'vue'; import Vuex, { Store } from 'vuex'; import cache from 'vuex-cache'; Vue.use(Vuex); const store = new Store({ plugins: [ cache({}) ], actions: { show(_, value) { console.log(value); } } }); const a = {}, b = {}; a.b = b; b.a = a; store.cache.dispatch('show', a); // It throws an error.
See by yourself on CodeSandbox.
@superwf vuex-cache uses JSON.stringify and it carries its limitations. So I propose fallback to uncached action instead of just throws Error.
vuex-cache
JSON.stringify
If you pass a payload with circular references to store.cache.dispatch it throws
TypeError: Converting circular structure to JSON
.This can be checked by running the code below.
See by yourself on CodeSandbox.
@superwf
vuex-cache
usesJSON.stringify
and it carries its limitations. So I propose fallback to uncached action instead of just throws Error.