diff --git a/frontend/src/store.ts b/frontend/src/store.ts index 3d8cd3c..99d22e9 100644 --- a/frontend/src/store.ts +++ b/frontend/src/store.ts @@ -215,14 +215,14 @@ function createStore({ if (ns === s) { return ns } - ns = validate(ns) - // If there is no validator, we assume we dont care about changes. if (!storeState && validator) { if (restoreValue) { ns.__didChange = didChange(ns) } } + ns = validate(ns) + if (saveToStorage) { storeState ? _saveToStorageNow(ns) : saveToStorage(ns) @@ -251,11 +251,11 @@ function createStore({ return s } const set = (s: S) => { + s.__didChange = didChange(s) if (saveToStorage) { saveToStorage(s) } s = validate(s) - s.__didChange = didChange(s) _set(merge({}, s)) } const reset = () => {