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