From d12fe6348e3ead6b3fd25cf0bab1a24287a68745 Mon Sep 17 00:00:00 2001 From: ajaysi Date: Mon, 6 Apr 2026 14:58:53 +0530 Subject: [PATCH] Fix: Skip non-podcast API calls in podcast-only mode - AlertsBadge: Skip agent alerts fetch in podcast mode - UserBadge: Skip system status fetch in podcast mode - SystemStatusIndicator: Skip monitoring stats in podcast mode This prevents 404 errors when frontend calls endpoints that don't exist in podcast-only demo mode. --- .../components/SystemStatusIndicator.tsx | 14 ++++++++++++++ frontend/src/components/shared/AlertsBadge.tsx | 7 +++++++ frontend/src/components/shared/UserBadge.tsx | 7 +++++++ 3 files changed, 28 insertions(+) diff --git a/frontend/src/components/ContentPlanningDashboard/components/SystemStatusIndicator.tsx b/frontend/src/components/ContentPlanningDashboard/components/SystemStatusIndicator.tsx index abe5af05..64aea511 100644 --- a/frontend/src/components/ContentPlanningDashboard/components/SystemStatusIndicator.tsx +++ b/frontend/src/components/ContentPlanningDashboard/components/SystemStatusIndicator.tsx @@ -21,6 +21,7 @@ import { Avatar } from '@mui/material'; import { apiClient } from '../../../api/client'; +import { isPodcastOnlyDemoMode } from '../../../utils/demoMode'; import { CheckCircle as HealthyIcon, Warning as WarningIcon, @@ -90,6 +91,19 @@ const SystemStatusIndicator: React.FC = ({ className const [, setCachePerf] = useState<{ hits: number; misses: number; hit_rate: number } | null>(null); const fetchStatus = async () => { + // Skip system status checks in podcast-only mode (endpoint not available) + if (isPodcastOnlyDemoMode()) { + setStatusData({ + status: 'unknown', + icon: '⚪', + recent_requests: 0, + recent_errors: 0, + error_rate: 0, + timestamp: new Date().toISOString() + }); + return; + } + setLoading(true); setError(null); diff --git a/frontend/src/components/shared/AlertsBadge.tsx b/frontend/src/components/shared/AlertsBadge.tsx index e545edb5..af0bd518 100644 --- a/frontend/src/components/shared/AlertsBadge.tsx +++ b/frontend/src/components/shared/AlertsBadge.tsx @@ -5,6 +5,7 @@ import { Warning as WarningIcon, Error as ErrorIcon, Info as InfoIcon, CheckCirc import { billingService } from '../../services/billingService'; import { useAuth } from '@clerk/clerk-react'; import { getTasksNeedingIntervention, TaskNeedingIntervention } from '../../api/schedulerDashboard'; +import { isPodcastOnlyDemoMode } from '../../utils/demoMode'; import { apiClient, isBackendCooldownActive, @@ -106,6 +107,12 @@ const AlertsBadge: React.FC = ({ colorMode = 'light' }) => { const fetchAlerts = async () => { if (!userId || isPollingRef.current) return; + // Skip alerts fetching in podcast-only mode (endpoints not available) + if (isPodcastOnlyDemoMode()) { + setLoading(false); + return; + } + if (isBackendCooldownActive()) { logBackendCooldownSkipOnce('AlertsBadge'); return; diff --git a/frontend/src/components/shared/UserBadge.tsx b/frontend/src/components/shared/UserBadge.tsx index dc996ac1..0a28d587 100644 --- a/frontend/src/components/shared/UserBadge.tsx +++ b/frontend/src/components/shared/UserBadge.tsx @@ -4,6 +4,7 @@ import { useUser, useClerk } from '@clerk/clerk-react'; import { useSubscription } from '../../contexts/SubscriptionContext'; import SystemStatusIndicator from '../ContentPlanningDashboard/components/SystemStatusIndicator'; import UsageDashboard from './UsageDashboard'; +import { isPodcastOnlyDemoMode } from '../../utils/demoMode'; import { apiClient, isBackendCooldownActive, @@ -30,6 +31,12 @@ const UserBadge: React.FC = ({ colorMode = 'light' }) => { // Fetch system status for status bulb useEffect(() => { + // Skip system status checks in podcast-only mode (endpoint not available) + if (isPodcastOnlyDemoMode()) { + setSystemStatus('unknown'); + return; + } + const fetchSystemStatus = async () => { if (isBackendCooldownActive()) { logBackendCooldownSkipOnce('UserBadge');