From 5e9942d55d4df28cb182781e4ca305112a3791b4 Mon Sep 17 00:00:00 2001 From: cialloo Date: Sun, 5 Oct 2025 18:54:21 +0800 Subject: [PATCH] Improve server data handling by retaining previous data on polling errors --- src/contexts/ServerContext.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/contexts/ServerContext.tsx b/src/contexts/ServerContext.tsx index 2719fbb..e66d4b6 100644 --- a/src/contexts/ServerContext.tsx +++ b/src/contexts/ServerContext.tsx @@ -115,7 +115,10 @@ export function ServerProvider({ children }: { children: ReactNode }) { // If we already have data from a previous successful fetch, keep using it // Only show error state if this is the very first fetch attempt setServers(prevServers => { - if (prevServers.length > 0 && hasInitialData) { + // Check if we have any previous successful data + const hasPreviousData = prevServers.some(s => s.a2sData) + + if (hasPreviousData) { // Keep previous data on polling errors return prevServers } else {