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
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 11s
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user