Refactor: Fix Router context error

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 15:54:08 +00:00
parent 1efd787a95
commit 5a1d4ee45b

View File

@@ -104,7 +104,8 @@ const queryClient = new QueryClient({
},
});
function AppContent(): React.JSX.Element {
// Navigation tracking component - must be inside Router context
function NavigationTracker() {
const location = useLocation();
const prevLocation = useRef<string>('');
@@ -114,9 +115,13 @@ function AppContent(): React.JSX.Element {
prevLocation.current = location.pathname;
}, [location.pathname]);
return null;
}
function AppContent(): React.JSX.Element {
return (
<TooltipProvider>
<BrowserRouter>
<NavigationTracker />
<LocationAutoDetectProvider />
<Toaster />
<Sonner />
@@ -362,7 +367,6 @@ function AppContent(): React.JSX.Element {
</div>
<Footer />
</div>
</BrowserRouter>
</TooltipProvider>
);
}
@@ -371,7 +375,9 @@ const App = (): React.JSX.Element => (
<QueryClientProvider client={queryClient}>
<AuthProvider>
<AuthModalProvider>
<BrowserRouter>
<AppContent />
</BrowserRouter>
</AuthModalProvider>
</AuthProvider>
{import.meta.env.DEV && <ReactQueryDevtools initialIsOpen={false} position="bottom" />}