diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2021-12-29 16:42:28 +0900 |
|---|---|---|
| committer | tamaina <tamaina@hotmail.co.jp> | 2021-12-29 16:42:28 +0900 |
| commit | 6836c8e98e46dbf3129b4e8fb3a799070454f356 (patch) | |
| tree | bd31cf8a548cb59ec19848a7e47437282f564cfc /packages/client/src | |
| parent | 必要な時以外はストレージを更新しない (diff) | |
| download | misskey-6836c8e98e46dbf3129b4e8fb3a799070454f356.tar.gz misskey-6836c8e98e46dbf3129b4e8fb3a799070454f356.tar.bz2 misskey-6836c8e98e46dbf3129b4e8fb3a799070454f356.zip | |
fix?
Diffstat (limited to 'packages/client/src')
| -rw-r--r-- | packages/client/src/pizzax.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/client/src/pizzax.ts b/packages/client/src/pizzax.ts index 7bfa6a2ab5..8a742e85fe 100644 --- a/packages/client/src/pizzax.ts +++ b/packages/client/src/pizzax.ts @@ -70,21 +70,21 @@ export class Storage<T extends StateDef> { } localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache)); }); - }, 1); - // streamingのuser storage updateイベントを監視して更新 - this.connection.on('registryUpdated', ({ scope, key, value }: { scope: string[], key: keyof T, value: T[typeof key]['default'] }) => { - if (scope[1] !== this.key || this.state[key] === value) return; + // streamingのuser storage updateイベントを監視して更新 + this.connection.on('registryUpdated', ({ scope, key, value }: { scope: string[], key: keyof T, value: T[typeof key]['default'] }) => { + if (scope[1] !== this.key || this.state[key] === value) return; - this.state[key] = value; - this.reactiveState[key].value = value; + this.state[key] = value; + this.reactiveState[key].value = value; - const cache = JSON.parse(localStorage.getItem(this.keyForLocalStorage + '::cache::' + $i.id) || '{}'); - if (cache[key] !== value) { - cache[key] = value; - localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache)); - } - }); + const cache = JSON.parse(localStorage.getItem(this.keyForLocalStorage + '::cache::' + $i.id) || '{}'); + if (cache[key] !== value) { + cache[key] = value; + localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache)); + } + }); + }, 1); } } |