diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-17 19:08:52 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-17 19:08:52 +0200 |
| commit | 84946b1fef64ee619f1c161d57ef4afdc533eae2 (patch) | |
| tree | 55d13c6536b5cc2bdb8754eb0d82b6339f01072b /packages/meshbay-hub/src/meshbay_hub/static/search-page.js | |
| parent | 7e01b7e8c2ce2ef9fce8b6c053c3b7210b64f9bf (diff) | |
| download | meshbay-84946b1fef64ee619f1c161d57ef4afdc533eae2.tar.gz | |
fix(spa): search hears a refused local network from the connection
On a Pixel, Chrome still lists the refused address when search gives
up, so nothing tells it from a silent node. The connection given up on
now runs to its own verdict and the refusal is reported then.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |