From 052c926d9b80634930dcc9d4d95b70353f10a047 Mon Sep 17 00:00:00 2001 From: zeppi Date: Fri, 10 Jun 2022 12:33:56 -0400 Subject: [PATCH 1/2] delay get-disk-space until daemon ready --- electron/index.js | 2 +- ui/index.jsx | 3 --- ui/redux/actions/app.js | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/electron/index.js b/electron/index.js index b1c36bcbd..db24617d7 100644 --- a/electron/index.js +++ b/electron/index.js @@ -323,7 +323,7 @@ ipcMain.on('get-disk-space', async (event) => { rendererWindow.webContents.send('send-disk-space', { diskSpace }); } catch (e) { rendererWindow.webContents.send('send-disk-space', { error: e.message || e }); - console.log('Failed to start LbryFirst', e); + console.log('Failed to get disk space', e); } }); diff --git a/ui/index.jsx b/ui/index.jsx index e75024174..1b739aad9 100644 --- a/ui/index.jsx +++ b/ui/index.jsx @@ -103,8 +103,6 @@ ipcRenderer.on('send-disk-space', (event, result) => { } }); -ipcRenderer.send('get-disk-space'); -// @if TARGET='app' ipcRenderer.on('open-uri-requested', (event, url, newSession) => { function handleError() { app.store.dispatch( @@ -191,7 +189,6 @@ document.addEventListener('click', (event) => { target = target.parentNode; } }); -// @endif document.addEventListener('dragover', (event) => { event.preventDefault(); diff --git a/ui/redux/actions/app.js b/ui/redux/actions/app.js index 2665ae06b..44e3941f4 100644 --- a/ui/redux/actions/app.js +++ b/ui/redux/actions/app.js @@ -341,7 +341,6 @@ export function doDaemonReady() { ); dispatch({ type: ACTIONS.DAEMON_READY }); - // @if TARGET='app' dispatch(doBalanceSubscribe()); dispatch(doSetAutoLaunch()); dispatch(doFindFFmpeg()); @@ -352,7 +351,7 @@ export function doDaemonReady() { dispatch(doCheckUpgradeAvailable()); } dispatch(doCheckUpgradeSubscribe()); - // @endif + ipcRenderer.send('get-disk-space'); }; } -- 2.45.2 From 11efdf0d6d6008701be9d14ae9f60b480733c2af Mon Sep 17 00:00:00 2001 From: zeppi Date: Fri, 10 Jun 2022 12:37:30 -0400 Subject: [PATCH 2/2] get fresh diskspace when storage viz renders --- ui/component/appStorageVisualization/view.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/component/appStorageVisualization/view.jsx b/ui/component/appStorageVisualization/view.jsx index 51c508585..dacd08ff3 100644 --- a/ui/component/appStorageVisualization/view.jsx +++ b/ui/component/appStorageVisualization/view.jsx @@ -1,6 +1,7 @@ // @flow import * as React from 'react'; import I18nMessage from 'component/i18nMessage'; +import { ipcRenderer } from 'electron'; type Props = { // --- select --- @@ -14,6 +15,9 @@ type Props = { function StorageViz(props: Props) { const { diskSpace, viewHostingLimit, autoHostingLimit, viewBlobSpace, autoBlobSpace, privateBlobSpace } = props; + React.useEffect(() => { + ipcRenderer.send('get-disk-space'); + }, []); if (!diskSpace || !diskSpace.total) { return ( -- 2.45.2