mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-09 04:56:45 +03:00
feat: enhance navigation handling by updating navigation key and improving page state management
This commit is contained in:
@@ -151,12 +151,17 @@ export function Dashboard() {
|
|||||||
|
|
||||||
// Register with global live refresh system
|
// Register with global live refresh system
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Only register if configuration is complete
|
||||||
|
if (!isFullyConfigured) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const unregister = registerRefreshCallback(() => {
|
const unregister = registerRefreshCallback(() => {
|
||||||
fetchDashboardData();
|
fetchDashboardData();
|
||||||
});
|
});
|
||||||
|
|
||||||
return unregister;
|
return unregister;
|
||||||
}, [registerRefreshCallback, fetchDashboardData]);
|
}, [registerRefreshCallback, fetchDashboardData, isFullyConfigured]);
|
||||||
|
|
||||||
// Status Card Skeleton component
|
// Status Card Skeleton component
|
||||||
function StatusCardSkeleton() {
|
function StatusCardSkeleton() {
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ function AppWithProviders({ page: initialPage }: AppProps) {
|
|||||||
|
|
||||||
const pageName = pageMap[path] || 'dashboard';
|
const pageName = pageMap[path] || 'dashboard';
|
||||||
setCurrentPage(pageName);
|
setCurrentPage(pageName);
|
||||||
|
// Also increment navigation key for browser navigation to trigger loading states
|
||||||
|
setNavigationKey(prev => prev + 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener('popstate', handlePopState);
|
window.addEventListener('popstate', handlePopState);
|
||||||
|
|||||||
@@ -478,7 +478,11 @@ export default function Repository() {
|
|||||||
</p>
|
</p>
|
||||||
<Button
|
<Button
|
||||||
variant="default"
|
variant="default"
|
||||||
onClick={() => window.location.href = "/config"}
|
onClick={() => {
|
||||||
|
window.history.pushState({}, '', '/config');
|
||||||
|
// We need to trigger a page change event for the navigation system
|
||||||
|
window.dispatchEvent(new PopStateEvent('popstate'));
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Go to Configuration
|
Go to Configuration
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user