diff --git a/src/views/base/settings/AppBrowserCacheSettingPageBase.ts b/src/views/base/settings/AppBrowserCacheSettingPageBase.ts index cd19c200..6a28f226 100644 --- a/src/views/base/settings/AppBrowserCacheSettingPageBase.ts +++ b/src/views/base/settings/AppBrowserCacheSettingPageBase.ts @@ -70,17 +70,26 @@ export function useAppBrowserCacheSettingPageBase() { } }); - function loadCacheStatistics(): Promise { + function loadCacheStatistics(updateLoadingState: boolean): Promise { return new Promise((resolve, reject) => { - loading.value = true; + if (updateLoadingState) { + loading.value = true; + } loadBrowserCacheStatistics().then(statistics => { fileCacheStatistics.value = statistics; exchangeRatesCacheSize.value = exchangeRatesStore.getExchangeRatesCacheSize(); - loading.value = false; + + if (updateLoadingState) { + loading.value = false; + } + resolve(); }).catch(error => { - loading.value = false; + if (updateLoadingState) { + loading.value = false; + } + reject(error); }); }); diff --git a/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue b/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue index 813a9585..31986b84 100644 --- a/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue +++ b/src/views/desktop/app/settings/tabs/AppBrowserCacheSettingTab.vue @@ -6,7 +6,7 @@
{{ tt('File Cache') }} + class="ms-2" :icon="true" :loading="loading" @click="loadCacheStatistics(true)"> @@ -88,9 +88,10 @@
- + {{ tt('Used storage') }} - {{ formatVolumeToLocalizedNumerals(exchangeRatesCacheSize ?? 0, 2) }} + + {{ formatVolumeToLocalizedNumerals(exchangeRatesCacheSize ?? 0, 2) }} @@ -188,7 +189,7 @@ const confirmDialog = useTemplateRef('confirmDialog'); function clearMapCache(): void { confirmDialog.value?.open('Are you sure you want to clear map data cache?').then(() => { clearMapDataCache().then(() => { - loadCacheStatistics(); + loadCacheStatistics(true); }); }); } @@ -207,5 +208,5 @@ function clearExchangeRatesCache(): void { }); } -loadCacheStatistics(); +loadCacheStatistics(true); diff --git a/src/views/mobile/settings/BrowserCacheSettingPage.vue b/src/views/mobile/settings/BrowserCacheSettingPage.vue index 467f885c..761df1ef 100644 --- a/src/views/mobile/settings/BrowserCacheSettingPage.vue +++ b/src/views/mobile/settings/BrowserCacheSettingPage.vue @@ -150,21 +150,17 @@ const showExchangeRatesDataCacheExpirationPopup = ref(false); const showMoreActionSheet = ref(false); function reloadCacheStatistics(done?: () => void): void { - loadCacheStatistics().then(() => { - if (done) { - done(); - } + loadCacheStatistics(false).then(() => { + done?.(); }).catch(() => { - if (done) { - done(); - } + done?.(); }); } function clearMapCache(): void { showConfirm('Are you sure you want to clear map data cache?', () => { clearMapDataCache().then(() => { - loadCacheStatistics(); + loadCacheStatistics(true); }); }); } @@ -183,5 +179,5 @@ function clearExchangeRatesCache(): void { }); } -loadCacheStatistics(); +loadCacheStatistics(true);