diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2021-12-30 03:37:57 +0900 |
|---|---|---|
| committer | tamaina <tamaina@hotmail.co.jp> | 2021-12-30 03:37:57 +0900 |
| commit | 97696b18a662185d1b50b6541166e5f4373cf6a6 (patch) | |
| tree | cd4e363fa34cc0e0a442e018e10c0f4ba4286708 /packages/client/src/pizzax.ts | |
| parent | :v: (diff) | |
| download | misskey-97696b18a662185d1b50b6541166e5f4373cf6a6.tar.gz misskey-97696b18a662185d1b50b6541166e5f4373cf6a6.tar.bz2 misskey-97696b18a662185d1b50b6541166e5f4373cf6a6.zip | |
fix
Diffstat (limited to 'packages/client/src/pizzax.ts')
| -rw-r--r-- | packages/client/src/pizzax.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/client/src/pizzax.ts b/packages/client/src/pizzax.ts index c8f75273fb..543450e070 100644 --- a/packages/client/src/pizzax.ts +++ b/packages/client/src/pizzax.ts @@ -106,10 +106,12 @@ export class Storage<T extends StateDef> { 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)); + this.addIdbSetJob(async () => { + const cache = await get(this.registryCacheKeyName); + if (cache[key] !== value) { + cache[key] = value; + await set(this.registryCacheKeyName, cache); + } } }); } |