Improve server data handling by retaining previous data on polling errors
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 11s

This commit is contained in:
2025-10-05 18:54:21 +08:00
parent 3abb7e0ad1
commit 5e9942d55d

View File

@@ -115,7 +115,10 @@ export function ServerProvider({ children }: { children: ReactNode }) {
// If we already have data from a previous successful fetch, keep using it // 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 // Only show error state if this is the very first fetch attempt
setServers(prevServers => { 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 // Keep previous data on polling errors
return prevServers return prevServers
} else { } else {