fix: replace magic numbers with named constants in polling logic

Address PR review feedback:
- Use WS_ACTIVITY_THRESHOLD constant instead of hardcoded 10000 in agent-info-panel.tsx
- Extract AGENT_OUTPUT_POLLING_INTERVAL constant for 5000ms value in use-features.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shirone
2026-01-21 16:10:22 +01:00
parent aac59c2b3a
commit 02de3df3df
2 changed files with 4 additions and 2 deletions

View File

@@ -117,7 +117,7 @@ export const AgentInfoPanel = memo(function AgentInfoPanel({
}
// If receiving WebSocket events, use longer polling interval as fallback
if (isReceivingWsEvents) {
return 10000;
return WS_ACTIVITY_THRESHOLD;
}
// Default polling interval
return 3000;

View File

@@ -15,6 +15,8 @@ import type { Feature } from '@/store/app-store';
const FEATURES_REFETCH_ON_FOCUS = false;
const FEATURES_REFETCH_ON_RECONNECT = false;
/** Default polling interval for agent output when WebSocket is inactive */
const AGENT_OUTPUT_POLLING_INTERVAL = 5000;
/**
* Fetch all features for a project
@@ -136,7 +138,7 @@ export function useAgentOutput(
}
// Only poll if we have data and it's not empty (indicating active task)
if (query.state.data && query.state.data.length > 0) {
return 5000; // 5 seconds
return AGENT_OUTPUT_POLLING_INTERVAL;
}
return false;
},