mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 00:53:08 +02:00
Fix bug
This commit is contained in:
parent
dae6d60163
commit
77078f2ce2
1 changed files with 3 additions and 0 deletions
|
@ -53,17 +53,20 @@ export class Storage<T extends StateDef> {
|
||||||
// なぜかsetTimeoutしないとapi関数内でエラーになる(おそらく循環参照してることに原因がありそう)
|
// なぜかsetTimeoutしないとapi関数内でエラーになる(おそらく循環参照してることに原因がありそう)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
api('i/registry/get-all', { scope: ['client', this.key] }).then(kvs => {
|
api('i/registry/get-all', { scope: ['client', this.key] }).then(kvs => {
|
||||||
|
const cache = {};
|
||||||
for (const [k, v] of Object.entries(def)) {
|
for (const [k, v] of Object.entries(def)) {
|
||||||
if (v.where === 'account') {
|
if (v.where === 'account') {
|
||||||
if (Object.prototype.hasOwnProperty.call(kvs, k)) {
|
if (Object.prototype.hasOwnProperty.call(kvs, k)) {
|
||||||
state[k] = kvs[k];
|
state[k] = kvs[k];
|
||||||
reactiveState[k].value = kvs[k];
|
reactiveState[k].value = kvs[k];
|
||||||
|
cache[k] = kvs[k];
|
||||||
} else {
|
} else {
|
||||||
state[k] = v.default;
|
state[k] = v.default;
|
||||||
reactiveState[k].value = v.default;
|
reactiveState[k].value = v.default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache));
|
||||||
});
|
});
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue