From 546db472e5fd03618550b98aa4de2669833f119a Mon Sep 17 00:00:00 2001
From: Arunavo Ray
Date: Sat, 24 May 2025 12:52:02 +0530
Subject: [PATCH] feat: enhance navigation handling by updating navigation key
and improving page state management
---
src/components/dashboard/Dashboard.tsx | 7 ++++++-
src/components/layout/MainLayout.tsx | 2 ++
src/components/repositories/Repository.tsx | 6 +++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/components/dashboard/Dashboard.tsx b/src/components/dashboard/Dashboard.tsx
index b3aa7bb..a3dfe91 100644
--- a/src/components/dashboard/Dashboard.tsx
+++ b/src/components/dashboard/Dashboard.tsx
@@ -151,12 +151,17 @@ export function Dashboard() {
// Register with global live refresh system
useEffect(() => {
+ // Only register if configuration is complete
+ if (!isFullyConfigured) {
+ return;
+ }
+
const unregister = registerRefreshCallback(() => {
fetchDashboardData();
});
return unregister;
- }, [registerRefreshCallback, fetchDashboardData]);
+ }, [registerRefreshCallback, fetchDashboardData, isFullyConfigured]);
// Status Card Skeleton component
function StatusCardSkeleton() {
diff --git a/src/components/layout/MainLayout.tsx b/src/components/layout/MainLayout.tsx
index 19463a2..4ed6607 100644
--- a/src/components/layout/MainLayout.tsx
+++ b/src/components/layout/MainLayout.tsx
@@ -74,6 +74,8 @@ function AppWithProviders({ page: initialPage }: AppProps) {
const pageName = pageMap[path] || 'dashboard';
setCurrentPage(pageName);
+ // Also increment navigation key for browser navigation to trigger loading states
+ setNavigationKey(prev => prev + 1);
};
window.addEventListener('popstate', handlePopState);
diff --git a/src/components/repositories/Repository.tsx b/src/components/repositories/Repository.tsx
index 50109f3..4a499e4 100644
--- a/src/components/repositories/Repository.tsx
+++ b/src/components/repositories/Repository.tsx
@@ -478,7 +478,11 @@ export default function Repository() {