From d165d8161e6d81288e8be2a8c9aeeb5ddf6cd843 Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Tue, 18 May 2021 17:15:56 +0800 Subject: [PATCH] Update save convert to check when to reload --- src/stores/saveManager.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/stores/saveManager.js b/src/stores/saveManager.js index 3dbc0c00..1d99e54f 100644 --- a/src/stores/saveManager.js +++ b/src/stores/saveManager.js @@ -71,6 +71,7 @@ const convertSave = async () => { const converted = localStorage.getItem(CONVERTED_KEY); if (converted !== null) return; + let convertedCount = 0; for (const [key, value] of Object.entries(localStorage)) { if (key.endsWith('ar') || key.endsWith('wl')) { await localforage.setItem(key, Number(value)); @@ -94,10 +95,17 @@ const convertSave = async () => { } else { await localforage.setItem(key, JSON.parse(value)); } + + if (!key.endsWith('locale')) { + convertedCount++; + } } localStorage.setItem(CONVERTED_KEY, dayjs().toISOString()); - window.location.reload(); + + if (convertedCount > 0) { + window.location.reload(); + } }; export const checkLocalSave = async () => {