Fix: Move FloatingChatButton and GlobalChatPane inside Router

The ModelSelector component uses useNavigate which requires Router context.
Move the floating chat components from App.tsx into AppRouter.tsx where
they have access to the BrowserRouter/HashRouter context.
This commit is contained in:
MK Fain committed 2025-12-03 19:47:29 -06:00
1 parent 68702abc41
commit 15c8040e35
2 files changed
+5 -4

No files matched your search

-4
View File
@@ -29,8 +29,6 @@ import { OfflineIndicator } from '@/components/OfflineIndicator';
import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt';
import { ErrorBoundary } from '@/components/ErrorBoundary';
import { GlobalChatProvider } from '@/components/GlobalChatProvider';
import { FloatingChatButton } from '@/components/FloatingChatButton';
import { GlobalChatPane } from '@/components/GlobalChatPane';
import AppRouter from './AppRouter';
@@ -189,8 +187,6 @@ export function App() {
<Suspense>
<AppRouter />
</Suspense>
<FloatingChatButton />
<GlobalChatPane />
</TooltipProvider>
</GlobalChatProvider>
</SessionManagerProvider>
+5
View File
@@ -2,6 +2,8 @@ import { BrowserRouter, HashRouter, Route, Routes } from "react-router-dom";
import { ScrollToTop } from "./components/ScrollToTop";
import { SessionMonitor } from "./components/SessionMonitor";
import { URLFragmentHandler } from "./components/URLFragmentHandler";
import { FloatingChatButton } from "./components/FloatingChatButton";
import { GlobalChatPane } from "./components/GlobalChatPane";
import Index from "./pages/Index";
import Clone from "./pages/Clone";
@@ -56,6 +58,9 @@ export function AppRouter() {
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
<Route path="*" element={<NotFound />} />
</Routes>
{/* Global floating chat - available on all pages */}
<FloatingChatButton />
<GlobalChatPane />
</Router>
);
}