aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-11-25 17:40:39 -0600
committerJP Dillingham <jp@dillingham.me>2022-11-25 17:40:39 -0600
commitfd72cac19e6beaa2ec6377b791f9b3d0bbd88d94 (patch)
tree8b7b2bbaeffb1b90e310a8e2a7e913bf2592127a
parent46fdeeec1db71068cf2562070a3802f812cef6e4 (diff)
downloadslskd-fd72cac19e6beaa2ec6377b791f9b3d0bbd88d94.tar.gz
suppress loader
-rw-r--r--src/web/src/components/System/Shares/index.js11
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]) => {