From fd72cac19e6beaa2ec6377b791f9b3d0bbd88d94 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 25 Nov 2022 17:40:39 -0600 Subject: suppress loader --- src/web/src/components/System/Shares/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/web') diff --git a/src/web/src/components/System/Shares/index.js b/src/web/src/components/System/Shares/index.js index c4282986..3d5b1858 100644 --- a/src/web/src/components/System/Shares/index.js +++ b/src/web/src/components/System/Shares/index.js @@ -30,16 +30,19 @@ const Index = ({ state = {} } = {}) => { }, []); useEffect(() => { - getAll(); + getAll({ quiet: true }); if (!scanning) { - setTimeout(() => getAll(), 1000); + // the state change out of scanning can fire before + // shares are updated, which leaves them stale. wait a second + // and fetch again. + setTimeout(() => getAll({ quiet: true }), 1000); } }, [scanning, scanPending]); - const getAll = async () => { + const getAll = async ({ quiet } = { quiet: false }) => { try { - setLoading(true); + if (!quiet) setLoading(true); const sharesByHost = await sharesLib.getAll(); const flattened = Object.entries(sharesByHost).reduce((acc, [host, shares]) => { -- cgit v1.2.3