From 54bf2808744a552fca45bdd6a08c351147f3cff2 Mon Sep 17 00:00:00 2001 From: tamaina Date: Wed, 29 Dec 2021 16:13:42 +0900 Subject: 必要な時以外はストレージを更新しない MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/pizzax.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/client/src') diff --git a/packages/client/src/pizzax.ts b/packages/client/src/pizzax.ts index 63abe40b03..7bfa6a2ab5 100644 --- a/packages/client/src/pizzax.ts +++ b/packages/client/src/pizzax.ts @@ -80,8 +80,10 @@ export class Storage { this.reactiveState[key].value = value; const cache = JSON.parse(localStorage.getItem(this.keyForLocalStorage + '::cache::' + $i.id) || '{}'); - cache[key] = value; - localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache)); + if (cache[key] !== value) { + cache[key] = value; + localStorage.setItem(this.keyForLocalStorage + '::cache::' + $i.id, JSON.stringify(cache)); + } }); } } -- cgit v1.2.3-freya