mirror of
https://github.com/paricafe/misskey.git
synced 2025-04-02 07:19:29 -05:00
chore(frontend): improve preference store stability
This commit is contained in:
parent
f797765b1d
commit
a4ba096e2a
1 changed files with 5 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue