From 77078f2ce22e926265c8838c67314b5b790ba97d Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 15 Jan 2021 22:38:39 +0900 Subject: [PATCH] Fix bug --- src/client/pizzax.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/pizzax.ts b/src/client/pizzax.ts index 794738edd4..396abc2418 100644 --- a/src/client/pizzax.ts +++ b/src/client/pizzax.ts @@ -53,17 +53,20 @@ export class Storage { // なぜかsetTimeoutしないとapi関数内でエラーになる(おそらく循環参照してることに原因がありそう) setTimeout(() => { api('i/registry/get-all', { scope: ['client', this.key] }).then(kvs => { + const cache = {}; for (const [k, v] of Object.entries(def)) { if (v.where === 'account') { if (Object.prototype.hasOwnProperty.call(kvs, k)) { state[k] = kvs[k]; reactiveState[k].value = kvs[k]; + cache[k] = kvs[k]; } else { state[k] = v.default; reactiveState[k].value = v.default; } } } + localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache)); }); }, 1);