summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-03-10 21:42:17 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-03-10 21:42:17 +0900
commita4ba096e2aa6897ba6782e4ad17262ac04f12b94 (patch)
treea19f9b9041e96fa57477e90fa1606ef7d91b5588
parentenhance(frontend): テーマ設定で簡易プレビューを表示するよ... (diff)
downloadsharkey-a4ba096e2aa6897ba6782e4ad17262ac04f12b94.tar.gz
sharkey-a4ba096e2aa6897ba6782e4ad17262ac04f12b94.tar.bz2
sharkey-a4ba096e2aa6897ba6782e4ad17262ac04f12b94.zip
chore(frontend): improve preference store stability
-rw-r--r--packages/frontend/src/preferences/store.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/frontend/src/preferences/store.ts b/packages/frontend/src/preferences/store.ts
index e10afcc308..e061021be3 100644
--- a/packages/frontend/src/preferences/store.ts
+++ b/packages/frontend/src/preferences/store.ts
@@ -45,12 +45,14 @@ export class Store<Data extends Record<string, any>> extends EventEmitter<StoreE
}
public commit<K extends keyof Data>(key: K, value: Data[K]) {
- this.r[key].value = this.s[key] = value;
- this.emit('updated', { key, value });
+ const v = JSON.parse(JSON.stringify(value)); // deep copy 兼 vueのプロキシ解除
+ this.r[key].value = this.s[key] = v;
+ this.emit('updated', { key, value: v });
}
public rewrite<K extends keyof Data>(key: K, value: Data[K]) {
- this.r[key].value = this.s[key] = value;
+ const v = JSON.parse(JSON.stringify(value)); // deep copy 兼 vueのプロキシ解除
+ this.r[key].value = this.s[key] = v;
}
/**