fix settings not persisting
This commit is contained in:
parent
d815f984fb
commit
a97c07bfdf
@ -1,6 +1,6 @@
|
|||||||
import merge from 'lodash.merge'
|
import merge from 'lodash.merge'
|
||||||
import localforage from 'localforage'
|
import localforage from 'localforage'
|
||||||
import { each, get, set } from 'lodash'
|
import { each, get, set, cloneDeep } from 'lodash'
|
||||||
|
|
||||||
let loaded = false
|
let loaded = false
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ export default function createPersistedState ({
|
|||||||
subscriber(store)((mutation, state) => {
|
subscriber(store)((mutation, state) => {
|
||||||
try {
|
try {
|
||||||
if (saveImmedeatelyActions.includes(mutation.type)) {
|
if (saveImmedeatelyActions.includes(mutation.type)) {
|
||||||
setState(key, reducer(state, paths), storage)
|
setState(key, reducer(cloneDeep(state), paths), storage)
|
||||||
.then(success => {
|
.then(success => {
|
||||||
if (typeof success !== 'undefined') {
|
if (typeof success !== 'undefined') {
|
||||||
if (mutation.type === 'setOption' || mutation.type === 'setCurrentUser') {
|
if (mutation.type === 'setOption' || mutation.type === 'setCurrentUser') {
|
||||||
|
Loading…
Reference in New Issue
Block a user