finds.dev

championswimmer/vuex-persist

A Vuex plugin to persist the store. (Fully Typescript enabled)

View on GitHubHomepage ↗

★ 1,645TypeScriptMITupdated Mar 2023

// the take

A Vuex plugin that saves store state to localStorage, cookies, or any storage adapter and restores it on load. It's for Vue 2 (and Vue 3 projects still on Vuex) apps that need persisted state without hand-rolling save/restore logic in every mutation.

The storage abstraction is genuinely flexible - it just needs getItem/setItem/clear, so it works with cookies, localForage/IndexedDB, or a custom backend with equal ease. The filter and reducer functions let you scope exactly which mutations trigger a write and which slice of state gets saved, so you're not serializing the whole store on every change. TypeScript generics on VuexPersistence<State, Payload> give you real type checking on reducers and filters instead of untyped callbacks.

No commits since March 2023, and it's built entirely around Vuex, which Vue itself has deprecated in favor of Pinia - new Vue 3 projects won't touch this, and existing Vuex apps are a shrinking population. The async storage path (localForage/IndexedDB) has a documented race condition: state restoration happens on a Promise, so mutations fired before restoration completes can get clobbered, and the workaround (await store.restored in a router guard) is a manual patch you have to wire into every app. Circular state support isn't built in - it requires pulling in a separate `flatted` dependency and flipping a flag, and strict mode support requires manually wiring a RESTORE_MUTATION into your store's mutations, which is easy to forget and fails silently if you don't.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
1,645
Forks
111
Language
TypeScript
License
MIT
Last commit
1 Mar 2023

// nearby

If vuex-persist isn't quite it.

All repos →