diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/search-page.js')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/static/search-page.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/search-page.js b/packages/meshbay-hub/src/meshbay_hub/static/search-page.js index d0150a8e..587e90ec 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/search-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/search-page.js @@ -269,6 +269,15 @@ function SearchPage({ token, username, userId, groups, onPlayQueue, userPrefs }) const [progress, setProgress] = useState({ done: 0, total: 0, unreachable: [] }); const [fetching, setFetching] = useState(false); const [lanBlocked, setLanBlocked] = useState([]); + // Added to as each refusal is known: some only once search has moved on. + const addLanBlocked = useCallback((more) => { + setLanBlocked((prev) => { + const fresh = more.filter((g) => !prev.some((p) => p.id === g.id)); + return fresh.length ? [...prev, ...fresh] : prev; + }); + }, []); + const groupsRef = useRef(groups); + groupsRef.current = groups; // Bumped by the Files breadcrumb refresh button — re-runs the all-groups // index fetch below, the only "cache" this page has. const [refreshTick, setRefreshTick] = useState(0); @@ -300,6 +309,9 @@ function SearchPage({ token, username, userId, groups, onPlayQueue, userPrefs }) // Rebuild the entry lists so tiles of the evicted group fall back to a // null `_tRef` (and pick a live one up again once reconnected). if (mountedRef.current) setConnectionGen((g) => g + 1); + }, (refusedId) => { + const g = (groupsRef.current || []).find((x) => x.id === refusedId); + if (g && mountedRef.current) addLanBlocked([g]); }); return () => { mountedRef.current = false; @@ -333,7 +345,7 @@ function SearchPage({ token, username, userId, groups, onPlayQueue, userPrefs }) setFetching(false); // Left up, unlike the line below: there is something to do about it, // and the group page says what (group-page.js explainLanRefusal). - setLanBlocked(refused); + addLanBlocked(refused); // Said once the pass is over, for a few seconds, rather than left above // the results: by then nothing more can be done about it here, and a // line that stays is one more thing between the reader and the results. |