Skip to content

Commit 17758fd

Browse files
committed
Reload the server list when the connection comes back
1 parent 3bde3bc commit 17758fd

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/App.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@ const App = memo(() => {
200200
};
201201
}, [windowResizeListener, initializeApp]);
202202

203+
useEffect(() => {
204+
// Refetch the server list once we get a connection back
205+
const handleOnline = () => {
206+
fetchServers();
207+
};
208+
209+
window.addEventListener("online", handleOnline);
210+
return () => window.removeEventListener("online", handleOnline);
211+
}, []);
212+
203213
const handleLoadingEnd = useCallback(async () => {
204214
const endTimer = PerformanceMonitor.time("loading-end");
205215
setLoading(false);

0 commit comments

Comments
 (0)