Skip to content

Commit

Permalink
Fix: #435
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyChen777 committed Mar 24, 2024
1 parent a60a83f commit 06b28e7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/extension/services/extension-preference-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ class ExtensionPreferenceStore<
if (!this._store.has(key)) {
this._store.set(key, value);
} else {
if (typeof value === "object" && !(value instanceof Array)) {
const oldValue = this._store.get(key);
for (const [subKey, subValue] of Object.entries(value)) {
if (!(subKey in oldValue)) {
oldValue[subKey] = subValue;
}
if (value.type === "options") {
const curValue = this._store.get(key);

console.log(curValue, value);
curValue.options = value.options;
if (curValue.options[curValue.value]) {
curValue.value = curValue.options[0];
}
this._store.set(key, oldValue);
this._store.set(key, curValue);
}
}
}
Expand Down

0 comments on commit 06b28e7

Please sign in to comment.