diff options
Diffstat (limited to 'src/web')
| -rw-r--r-- | src/web/src/components/System/Shares/index.js | 11 |
1 files changed, 7 insertions, 4 deletions
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]) => { |
