Skip to content

Commit

Permalink
fix(frontend): config-store now validates on first change, instead of…
Browse files Browse the repository at this point in the history
… second
  • Loading branch information
runar-rkmedia committed Nov 14, 2021
1 parent d1a0ce0 commit 7a5fedc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ function createStore<T extends {}, V = null, VK extends string = string>({
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)
Expand Down Expand Up @@ -251,11 +251,11 @@ function createStore<T extends {}, V = null, VK extends string = string>({
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 = () => {
Expand Down

0 comments on commit 7a5fedc

Please sign in to comment.