From 5db9f585e8cec20abdadf431d667422af66cf692 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Thu, 13 May 2021 11:58:35 +0200 Subject: Lazily compute cache size (#1404) Computing the cache size can take a long time if the cache is large. Previously, cache size computation was triggered by opening the Settings pane, which slowed down changing settings even if the user wasn't interested in the cache size. This patch defers cache size computation until the Advanced tab is open in the Setting page. Additionally, cache size rendering (in MB / GB) is moved from the AppStore into the EditSettingsForm to fix the notCleared functionality. --- src/stores/AppStore.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/stores/AppStore.js') diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 529201df5..c409b6ac7 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js @@ -4,7 +4,6 @@ import { } from 'mobx'; import moment from 'moment'; import AutoLaunch from 'auto-launch'; -import prettyBytes from 'pretty-bytes'; import ms from 'ms'; import { URL } from 'url'; import os from 'os'; @@ -257,7 +256,7 @@ export default class AppStore extends Store { } @computed get cacheSize() { - return prettyBytes(this.getAppCacheSizeRequest.execute().result || 0); + return this.getAppCacheSizeRequest.execute().result; } @computed get debugInfo() { -- cgit v1.2.3-70-g09d2