fix(error-logs-monitor): properly handle status loading state

- Add isStatusLoading check to prevent false-negative rendering
- Use nullish coalescing for enabled param to ensure boolean value
- Component now waits for status before deciding visibility

Fixes initial render returning null due to undefined status
This commit is contained in:
kaitranntt
2025-12-18 02:45:58 -05:00
parent ddf7b704a5
commit 1ef625ee86
+7 -3
View File
@@ -79,11 +79,15 @@ function ErrorLogContent({ name }: { name: string }) {
}
export function ErrorLogsMonitor() {
const { data: status } = useCliproxyStatus();
const { data: logs, isLoading, error } = useCliproxyErrorLogs(status?.running);
const { data: status, isLoading: isStatusLoading } = useCliproxyStatus();
const { data: logs, isLoading, error } = useCliproxyErrorLogs(status?.running ?? false);
const [expandedLog, setExpandedLog] = useState<string | null>(null);
// Don't show if proxy not running or loading
// Don't show while status is loading or if proxy not running
if (isStatusLoading) {
return null;
}
if (!status?.running) {
return null;
}