While working on server management, I noticed that the frontend was making tons of unnecessary API calls to servers that have a "Not OK" status. Every time you visit a server page with an unreachable server, the UI tries to fetch system stats, CPU info, memory data, and container information - all of which are guaranteed to fail with 500 errors, flooding the browser console.
This creates several issues:
Browser console spam with repeated 500 errors from GetSystemStats and GetSystemInformation
Pointless backend load from requests that will never succeed
Poor user experience with constant failed API calls
Network traffic waste for unreachable servers
Solution:
I've added server availability guards to prevent API calls to unreachable servers:
New Helper Function: useIsServerAvailable() that checks if server state is not Disabled or NotOk
Protected API Calls: All server-related queries now use the enabled option to check server availability first
Consistent Pattern: Applied the same logic across all server components
The fix uses React Query's enabled option with server status checks:
No more 500 error spam in console when servers are down
No more unnecessary API calls to unreachable servers
Better performance and reduced backend load
Cleaner user experience when managing server infrastructure
Everything still works perfectly when servers are online
The changes are backward compatible and respect existing server status logic that was already in place in some components.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/moghtech/komodo/pull/843
**Author:** [@MP-Tool](https://github.com/MP-Tool)
**Created:** 9/12/2025
**Status:** ✅ Merged
**Merged:** 9/14/2025
**Merged by:** [@mbecker20](https://github.com/mbecker20)
**Base:** `1.19.4` ← **Head:** `fix/server-status-based-api-queries`
---
### 📝 Commits (2)
- [`230700c`](https://github.com/moghtech/komodo/commit/230700c6a6c359965d5be8989ed8e37ea890363f) Implement server availability checks in various components
- [`183a963`](https://github.com/moghtech/komodo/commit/183a96367e6f227199eb97a026c6b86926366e15) Refactor server availability check to ensure only healthy servers are identified
### 📊 Changes
**3 files changed** (+37 additions, -15 deletions)
<details>
<summary>View changed files</summary>
📝 `frontend/src/components/resources/server/index.tsx` (+14 -8)
📝 `frontend/src/components/resources/server/monitoring-table.tsx` (+12 -3)
📝 `frontend/src/components/resources/server/stats.tsx` (+11 -4)
</details>
### 📄 Description
## Problem:
While working on server management, I noticed that the frontend was making tons of unnecessary API calls to servers that have a "Not OK" status. Every time you visit a server page with an unreachable server, the UI tries to fetch system stats, CPU info, memory data, and container information - all of which are guaranteed to fail with 500 errors, flooding the browser console.
This creates several issues:
- Browser console spam with repeated 500 errors from `GetSystemStats` and `GetSystemInformation`
- Pointless backend load from requests that will never succeed
- Poor user experience with constant failed API calls
- Network traffic waste for unreachable servers
## Solution:
I've added server availability guards to prevent API calls to unreachable servers:
1. **New Helper Function**: `useIsServerAvailable()` that checks if server state is not `Disabled` or `NotOk`
2. **Protected API Calls**: All server-related queries now use the `enabled` option to check server availability first
3. **Consistent Pattern**: Applied the same logic across all server components
The fix uses React Query's `enabled` option with server status checks:
```typescript
const isServerAvailable = useIsServerAvailable(serverId);
const stats = useRead("GetSystemStats", { server: id }, {
enabled: isServerAvailable,
refetchInterval: 10_000
});
```
This means:
- No more 500 error spam in console when servers are down
- No more unnecessary API calls to unreachable servers
- Better performance and reduced backend load
- Cleaner user experience when managing server infrastructure
- Everything still works perfectly when servers are online
The changes are backward compatible and respect existing server status logic that was already in place in some components.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/moghtech/komodo/pull/843
Author: @MP-Tool
Created: 9/12/2025
Status: ✅ Merged
Merged: 9/14/2025
Merged by: @mbecker20
Base:
1.19.4← Head:fix/server-status-based-api-queries📝 Commits (2)
230700cImplement server availability checks in various components183a963Refactor server availability check to ensure only healthy servers are identified📊 Changes
3 files changed (+37 additions, -15 deletions)
View changed files
📝
frontend/src/components/resources/server/index.tsx(+14 -8)📝
frontend/src/components/resources/server/monitoring-table.tsx(+12 -3)📝
frontend/src/components/resources/server/stats.tsx(+11 -4)📄 Description
Problem:
While working on server management, I noticed that the frontend was making tons of unnecessary API calls to servers that have a "Not OK" status. Every time you visit a server page with an unreachable server, the UI tries to fetch system stats, CPU info, memory data, and container information - all of which are guaranteed to fail with 500 errors, flooding the browser console.
This creates several issues:
GetSystemStatsandGetSystemInformationSolution:
I've added server availability guards to prevent API calls to unreachable servers:
useIsServerAvailable()that checks if server state is notDisabledorNotOkenabledoption to check server availability firstThe fix uses React Query's
enabledoption with server status checks:This means:
The changes are backward compatible and respect existing server status logic that was already in place in some components.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.