diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2021-12-30 03:01:53 +0900 |
|---|---|---|
| committer | tamaina <tamaina@hotmail.co.jp> | 2021-12-30 03:01:53 +0900 |
| commit | 2a1258e5d9a2858644b8f68aa4abf432bd0c0810 (patch) | |
| tree | 66055ea39288cf99deb0088b5510559d3dc336d0 | |
| parent | Merge branch 'develop' into pizzax-indexeddb (diff) | |
| parent | スコープの判定を厳密に (diff) | |
| download | misskey-2a1258e5d9a2858644b8f68aa4abf432bd0c0810.tar.gz misskey-2a1258e5d9a2858644b8f68aa4abf432bd0c0810.tar.bz2 misskey-2a1258e5d9a2858644b8f68aa4abf432bd0c0810.zip | |
Merge branch 'fix-pizzax-2' into pizzax-indexeddb
| -rw-r--r-- | packages/client/src/pizzax.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/client/src/pizzax.ts b/packages/client/src/pizzax.ts index c05e1fcf13..c8f75273fb 100644 --- a/packages/client/src/pizzax.ts +++ b/packages/client/src/pizzax.ts @@ -100,16 +100,16 @@ export class Storage<T extends StateDef> { }, 1); // streamingのuser storage updateイベントを監視して更新 - connection?.on('registryUpdated', async ({ scope, key, value }: { scope: string[], key: keyof T, value: T[typeof key]['default'] }) => { - if (scope[1] !== this.key || this.state[key] === value) return; - + connection?.on('registryUpdated', ({ scope, key, value }: { scope: string[], key: keyof T, value: T[typeof key]['default'] }) => { + if (scope.length !== 2 || scope[0] !== 'client' || scope[1] !== this.key || this.state[key] === value) return; + this.state[key] = value; this.reactiveState[key].value = value; - - const cache = await get(this.registryCacheKeyName); + + const cache = JSON.parse(localStorage.getItem(this.keyForLocalStorage + '::cache::' + $i.id) || '{}'); if (cache[key] !== value) { cache[key] = value; - await set(this.registryCacheKeyName, cache); + localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache)); } }); } |