commit: a97c07bfdfd8b69d59fec619d269cf14d65d8e0c
parent d815f984fb354da2262d6a6e55b281aad817cda2
Author: Henry Jameson <me@hjkos.com>
Date: Thu, 17 Mar 2022 09:02:26 +0200
fix settings not persisting
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js
@@ -1,6 +1,6 @@
import merge from 'lodash.merge'
import localforage from 'localforage'
-import { each, get, set } from 'lodash'
+import { each, get, set, cloneDeep } from 'lodash'
let loaded = false
@@ -69,7 +69,7 @@ export default function createPersistedState ({
subscriber(store)((mutation, state) => {
try {
if (saveImmedeatelyActions.includes(mutation.type)) {
- setState(key, reducer(state, paths), storage)
+ setState(key, reducer(cloneDeep(state), paths), storage)
.then(success => {
if (typeof success !== 'undefined') {
if (mutation.type === 'setOption' || mutation.type === 'setCurrentUser') {