From de0e42cca80987a8c31808c30b31ffe0d354a05c Mon Sep 17 00:00:00 2001 From: "IGNY8 VPS (Salman)" Date: Mon, 5 Jan 2026 04:52:16 +0000 Subject: [PATCH] Phase 1 fixes --- frontend/src/App.tsx | 4 ++-- .../src/components/common/SuspenseLoader.tsx | 16 ++++++++++++++ frontend/src/layout/AppLayout.tsx | 11 ++-------- .../src/pages/Automation/AutomationPage.tsx | 8 ------- .../src/pages/Optimizer/ContentSelector.tsx | 9 +------- frontend/src/pages/Planner/ClusterDetail.tsx | 11 ---------- .../src/pages/Publisher/ContentCalendar.tsx | 11 ---------- .../src/pages/Settings/CreditsAndBilling.tsx | 12 ----------- frontend/src/pages/Settings/Sites.tsx | 11 ---------- frontend/src/pages/Sites/Content.tsx | 6 +----- frontend/src/pages/Sites/Dashboard.tsx | 11 ---------- frontend/src/pages/Sites/List.tsx | 11 ---------- frontend/src/pages/Sites/PageManager.tsx | 11 ---------- frontend/src/pages/Sites/PostEditor.tsx | 11 ---------- frontend/src/pages/Sites/PublishingQueue.tsx | 11 ---------- frontend/src/pages/Sites/Settings.tsx | 11 ---------- frontend/src/pages/Sites/SyncDashboard.tsx | 11 ---------- frontend/src/pages/Thinker/Prompts.tsx | 14 ------------- .../src/pages/account/AccountSettingsPage.tsx | 1 - .../src/pages/account/ContentSettingsPage.tsx | 14 ------------- .../src/pages/account/PurchaseCreditsPage.tsx | 17 --------------- .../src/pages/account/UsageAnalyticsPage.tsx | 21 ------------------- 22 files changed, 22 insertions(+), 221 deletions(-) create mode 100644 frontend/src/components/common/SuspenseLoader.tsx diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 5de2ea90..ff9d1e6b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -10,6 +10,7 @@ import LoadingStateMonitor from "./components/common/LoadingStateMonitor"; import { PageProvider } from "./context/PageContext"; import { useAuthStore } from "./store/authStore"; import { useModuleStore } from "./store/moduleStore"; +import SuspenseLoader from "./components/common/SuspenseLoader"; // Auth pages - loaded immediately (needed for login) import SignIn from "./pages/AuthPages/SignIn"; @@ -131,8 +132,7 @@ export default function App() { - {/* CRITICAL FIX: Move Suspense OUTSIDE Routes to prevent Router context loss during HMR */} -
Loading...
}> + }> {/* Auth Routes - Public */} } /> diff --git a/frontend/src/components/common/SuspenseLoader.tsx b/frontend/src/components/common/SuspenseLoader.tsx new file mode 100644 index 00000000..b6142d79 --- /dev/null +++ b/frontend/src/components/common/SuspenseLoader.tsx @@ -0,0 +1,16 @@ +/** + * Suspense Loader - Standalone loading component for React Suspense fallback + * No context dependencies - can be used anywhere + */ +import React from 'react'; + +const SuspenseLoader: React.FC = () => { + return ( +
+
+

Loading page...

+
+ ); +}; + +export default SuspenseLoader; diff --git a/frontend/src/layout/AppLayout.tsx b/frontend/src/layout/AppLayout.tsx index 97e80829..275f154d 100644 --- a/frontend/src/layout/AppLayout.tsx +++ b/frontend/src/layout/AppLayout.tsx @@ -11,8 +11,7 @@ import { useHeaderMetrics } from "../context/HeaderMetricsContext"; import { useErrorHandler } from "../hooks/useErrorHandler"; import { trackLoading } from "../components/common/LoadingStateMonitor"; import PendingPaymentBanner from "../components/billing/PendingPaymentBanner"; -import { PageLoadingProvider, usePageLoadingContext } from "../context/PageLoadingContext"; -import PageLoader from "../components/common/PageLoader"; +import { PageLoadingProvider } from "../context/PageLoadingContext"; const LayoutContent: React.FC = () => { const { isExpanded, isHovered, isMobileOpen } = useSidebar(); @@ -178,14 +177,8 @@ const LayoutContent: React.FC = () => { ); }; -// Wrapper component to conditionally render Outlet or PageLoader +// Wrapper component - just renders children (global loading removed to avoid unmounting issues) const PageLoaderWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => { - const { isLoading } = usePageLoadingContext(); - - if (isLoading) { - return ; - } - return <>{children}; }; diff --git a/frontend/src/pages/Automation/AutomationPage.tsx b/frontend/src/pages/Automation/AutomationPage.tsx index b6ea724e..0597cd39 100644 --- a/frontend/src/pages/Automation/AutomationPage.tsx +++ b/frontend/src/pages/Automation/AutomationPage.tsx @@ -372,14 +372,6 @@ const AutomationPage: React.FC = () => { } }; - if (loading) { - return ( -
-
Loading automation...
-
- ); - } - if (!activeSite) { return (
diff --git a/frontend/src/pages/Optimizer/ContentSelector.tsx b/frontend/src/pages/Optimizer/ContentSelector.tsx index 453e62cf..d7042102 100644 --- a/frontend/src/pages/Optimizer/ContentSelector.tsx +++ b/frontend/src/pages/Optimizer/ContentSelector.tsx @@ -184,13 +184,7 @@ export default function OptimizerContentSelector() { {/* Filters */} - {loading ? ( -
-
-

Loading content...

-
- ) : ( -
+
@@ -300,7 +294,6 @@ export default function OptimizerContentSelector() { )} - )} {/* Module footer placeholder - module on hold */} diff --git a/frontend/src/pages/Planner/ClusterDetail.tsx b/frontend/src/pages/Planner/ClusterDetail.tsx index ef2b9167..2cefda9a 100644 --- a/frontend/src/pages/Planner/ClusterDetail.tsx +++ b/frontend/src/pages/Planner/ClusterDetail.tsx @@ -119,17 +119,6 @@ export default function ClusterDetail() { setActiveTab(tab); }; - if (loading) { - return ( - <> - -
-
Loading cluster...
-
- - ); - } - if (!cluster) { return ( <> diff --git a/frontend/src/pages/Publisher/ContentCalendar.tsx b/frontend/src/pages/Publisher/ContentCalendar.tsx index 287831b1..9f0f00ff 100644 --- a/frontend/src/pages/Publisher/ContentCalendar.tsx +++ b/frontend/src/pages/Publisher/ContentCalendar.tsx @@ -392,17 +392,6 @@ export default function ContentCalendar() { ); } - if (loading) { - return ( - <> - -
-
Loading calendar...
-
- - ); - } - return ( <> diff --git a/frontend/src/pages/Settings/CreditsAndBilling.tsx b/frontend/src/pages/Settings/CreditsAndBilling.tsx index 7ad2a238..e2e58ca3 100644 --- a/frontend/src/pages/Settings/CreditsAndBilling.tsx +++ b/frontend/src/pages/Settings/CreditsAndBilling.tsx @@ -64,18 +64,6 @@ const CreditsAndBilling: React.FC = () => { ).join(' '); }; - if (loading) { - return ( - <> - -
-
-

Loading billing data...

-
- - ); - } - return ( <> diff --git a/frontend/src/pages/Settings/Sites.tsx b/frontend/src/pages/Settings/Sites.tsx index 44a3742a..59c54181 100644 --- a/frontend/src/pages/Settings/Sites.tsx +++ b/frontend/src/pages/Settings/Sites.tsx @@ -375,17 +375,6 @@ export default function Sites() { return industry?.sectors || []; }; - if (loading) { - return ( -
-
-
-

Loading sites...

-
-
- ); - } - return ( <> diff --git a/frontend/src/pages/Sites/Content.tsx b/frontend/src/pages/Sites/Content.tsx index 5ee736aa..1d9162ed 100644 --- a/frontend/src/pages/Sites/Content.tsx +++ b/frontend/src/pages/Sites/Content.tsx @@ -215,11 +215,7 @@ export default function SiteContentManager() { {/* Content List */} - {loading ? ( - -
Loading content...
-
- ) : filteredContent.length === 0 ? ( + {filteredContent.length === 0 ? (

No content found diff --git a/frontend/src/pages/Sites/Dashboard.tsx b/frontend/src/pages/Sites/Dashboard.tsx index 872489fd..699936ba 100644 --- a/frontend/src/pages/Sites/Dashboard.tsx +++ b/frontend/src/pages/Sites/Dashboard.tsx @@ -229,17 +229,6 @@ export default function SiteDashboard() { } }; - if (loading) { - return ( - <> - -

-
Loading site dashboard...
-
- - ); - } - if (!site) { return ( <> diff --git a/frontend/src/pages/Sites/List.tsx b/frontend/src/pages/Sites/List.tsx index aef4b12d..c7a9f050 100644 --- a/frontend/src/pages/Sites/List.tsx +++ b/frontend/src/pages/Sites/List.tsx @@ -477,17 +477,6 @@ export default function SiteList() { const hasActiveFilters = searchTerm || siteTypeFilter || hostingTypeFilter || statusFilter || integrationFilter; - if (loading) { - return ( - <> - -
-
Loading sites...
-
- - ); - } - return ( <> diff --git a/frontend/src/pages/Sites/PageManager.tsx b/frontend/src/pages/Sites/PageManager.tsx index 8542d5f2..62f77e03 100644 --- a/frontend/src/pages/Sites/PageManager.tsx +++ b/frontend/src/pages/Sites/PageManager.tsx @@ -264,17 +264,6 @@ export default function PageManager() { } }; - if (loading) { - return ( - <> - -
-
Loading pages...
-
- - ); - } - return ( <> diff --git a/frontend/src/pages/Sites/PostEditor.tsx b/frontend/src/pages/Sites/PostEditor.tsx index 3929a36a..7c5c2558 100644 --- a/frontend/src/pages/Sites/PostEditor.tsx +++ b/frontend/src/pages/Sites/PostEditor.tsx @@ -216,17 +216,6 @@ export default function PostEditor() { { value: 'published', label: 'Published' }, ]; - if (loading) { - return ( - <> - -
-
Loading post...
-
- - ); - } - return ( <> diff --git a/frontend/src/pages/Sites/PublishingQueue.tsx b/frontend/src/pages/Sites/PublishingQueue.tsx index 332841bd..200b8b88 100644 --- a/frontend/src/pages/Sites/PublishingQueue.tsx +++ b/frontend/src/pages/Sites/PublishingQueue.tsx @@ -206,17 +206,6 @@ export default function PublishingQueue() { }); }; - if (loading) { - return ( - <> - -
-
Loading queue...
-
- - ); - } - return ( <> diff --git a/frontend/src/pages/Sites/Settings.tsx b/frontend/src/pages/Sites/Settings.tsx index 46bdee9d..999f1f23 100644 --- a/frontend/src/pages/Sites/Settings.tsx +++ b/frontend/src/pages/Sites/Settings.tsx @@ -667,17 +667,6 @@ export default function SiteSettings() { { value: 'multi', label: 'Multi-Destination' }, ]; - if (loading) { - return ( - <> - -
-
Loading site settings...
-
- - ); - } - return ( <> diff --git a/frontend/src/pages/Sites/SyncDashboard.tsx b/frontend/src/pages/Sites/SyncDashboard.tsx index bfb68c14..e045c8d3 100644 --- a/frontend/src/pages/Sites/SyncDashboard.tsx +++ b/frontend/src/pages/Sites/SyncDashboard.tsx @@ -116,17 +116,6 @@ export default function SyncDashboard() { } }; - if (loading) { - return ( - <> - -
-
Loading sync data...
-
- - ); - } - if (!syncStatus) { return ( <> diff --git a/frontend/src/pages/Thinker/Prompts.tsx b/frontend/src/pages/Thinker/Prompts.tsx index 05383e05..f148f091 100644 --- a/frontend/src/pages/Thinker/Prompts.tsx +++ b/frontend/src/pages/Thinker/Prompts.tsx @@ -184,20 +184,6 @@ export default function Prompts() { }); }; - if (loading) { - return ( - <> - -
-
-
-

Loading prompts...

-
-
- - ); - } - return ( <> diff --git a/frontend/src/pages/account/AccountSettingsPage.tsx b/frontend/src/pages/account/AccountSettingsPage.tsx index 1da7a5ef..f7f86355 100644 --- a/frontend/src/pages/account/AccountSettingsPage.tsx +++ b/frontend/src/pages/account/AccountSettingsPage.tsx @@ -832,7 +832,6 @@ export default function AccountSettingsPage() { - ); } diff --git a/frontend/src/pages/account/ContentSettingsPage.tsx b/frontend/src/pages/account/ContentSettingsPage.tsx index 3115c767..cb301a19 100644 --- a/frontend/src/pages/account/ContentSettingsPage.tsx +++ b/frontend/src/pages/account/ContentSettingsPage.tsx @@ -311,20 +311,6 @@ export default function ContentSettingsPage() { images: 'Image Settings', }; - if (loading) { - return ( -
- -
-
- -
Loading settings...
-
-
-
- ); - } - return (
diff --git a/frontend/src/pages/account/PurchaseCreditsPage.tsx b/frontend/src/pages/account/PurchaseCreditsPage.tsx index 71b5c942..5027c2f6 100644 --- a/frontend/src/pages/account/PurchaseCreditsPage.tsx +++ b/frontend/src/pages/account/PurchaseCreditsPage.tsx @@ -145,23 +145,6 @@ export default function PurchaseCreditsPage() { } }; - if (loading) { - return ( - <> - - , color: 'blue' }} - /> -
-
- -
-
- - ); - } - if (showManualPaymentForm && invoiceData) { const selectedMethod = paymentMethods.find((m) => m.type === selectedPaymentMethod); diff --git a/frontend/src/pages/account/UsageAnalyticsPage.tsx b/frontend/src/pages/account/UsageAnalyticsPage.tsx index aa37f678..53f7ae93 100644 --- a/frontend/src/pages/account/UsageAnalyticsPage.tsx +++ b/frontend/src/pages/account/UsageAnalyticsPage.tsx @@ -56,26 +56,6 @@ export default function UsageAnalyticsPage() { } }; - if (loading) { - return ( - <> - - , color: 'blue' }} - /> -
-
-
-
-
Loading usage data...
-
-
-
- - ); - } - const tabTitles: Record = { limits: 'Limits & Usage', activity: 'Credit History', @@ -280,7 +260,6 @@ export default function UsageAnalyticsPage() {
)} - ); }