From 7e61d16f0ca6aeca6adb1dd909a7e7b0376719f9 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sat, 17 Oct 2026 10:11:07 +0200 Subject: fix(spa): follow the device to another network Moving between mobile data and the node's Wi-Fi left the connection on the network it had left until ICE gave up, and a group that had failed was never tried again: the Android application had to be killed. A change of network or an ICE disconnection now pings the session and reconnects one that does not answer, wakes a reconnect backing off, and retries a group page left on an error. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/src/meshbay_hub/static/group-page.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/static/group-page.js') diff --git a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js index 5972e000..728ffc37 100644 --- a/packages/meshbay-hub/src/meshbay_hub/static/group-page.js +++ b/packages/meshbay-hub/src/meshbay_hub/static/group-page.js @@ -789,6 +789,18 @@ function GroupPage({ groupId, group, token, username, userId, userPrefs, // it; nothing in between should disturb a working connection. }, [groupId, Boolean(token), retryKey]); + // A group that could not be reached is tried again when the device joins + // another network: from the Wi-Fi to mobile data, or back, is what decides + // whether the node can be reached, and in the Android application there is + // no reload to do it. Not while a code, a passphrase or a device link is + // asked for: those wait for the person, not for a network. + useEffect(() => { + if (status !== 'error' || needsPass || needsCode || needsDevice) return undefined; + const T = window.MeshBayTransport; + if (!T || !T.onNetworkChange) return undefined; + return T.onNetworkChange(() => setRetryKey((k) => k + 1)); + }, [status, needsPass, needsCode, needsDevice]); + const downloadFileForModal = useCallback(async (entry) => { // The video/preview modals' own download button — the table's row and // toolbar actions call the same shared helper from files-app.js, since -- cgit v1.2.3