filter is still saving the mutation to localforge
See original GitHub issueCurrently I have:
const ignoreMutations = [
'currentUser/setAuthenticated',
'currentUser/setLoggedIn',
'resource/setTypes',
'resource/setCurrentVideo',
]
const vuexPersist = new VuexPersist({
asyncStorage: true,
key: 'vuex',
storage: localForage,
filter: mutation => !ignoreMutations.includes(mutation.type),
}).plugin
When I check localforge the data has been saved, shouldn’t this not be the case?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Why Vuex-persist doesn't store anything in localStorage?
As said in the guide. The only way to actually change state in a Vuex store is by committing a mutation.
Read more >Persist Vuex State with vuex-persist - DigitalOcean
Save your Vuex state to localStorage, sessionStorage, cookies, and more with ... filter: mutation => (true) }) const store = new Vuex.
Read more >PersistOptions | vuex-persist - championswimmer
Method to filter which mutations will trigger state saving Be default returns true for all mutations. Check mutations using mutation.type.
Read more >vuex-persist - npm
Choose which mutations trigger store save, and which don't, using filter ... Denotes if the store uses Promises (like localforage) or not
Read more >persistQueryClient | TanStack Query Docs
This is set of utilities for interacting with "persisters" which save your ... Your query/mutation are dehydrated and stored by the persister you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@championswimmer I see why it’s not working as I expected. https://github.com/championswimmer/vuex-persist/blob/master/src/index.ts#L169-L172 It’s saving the entire state regardless of what the mutation is. So lets say you have a state like:
and you have 3 mutations
setAuthenticated
,setLoggedIn
and,setData
; If I have the following config that I showed above:If the mutation
setData
gets called, it is still going to save the state forauthenticated
andloggedIn
, as it’s saving the entire state. I think what it should do instead is just deep merge in the mutation data.@cj How did you finally solve this problem