diff --git a/ui/src/App.tsx b/ui/src/App.tsx
index 13811346..62ecb304 100644
--- a/ui/src/App.tsx
+++ b/ui/src/App.tsx
@@ -1,5 +1,5 @@
import { lazy, Suspense } from 'react';
-import { BrowserRouter, Navigate, Routes, Route } from 'react-router-dom';
+import { BrowserRouter, Routes, Route } from 'react-router-dom';
import { QueryClientProvider } from '@tanstack/react-query';
import { Toaster } from 'sonner';
import { queryClient } from '@/lib/query-client';
@@ -8,7 +8,6 @@ import { PrivacyProvider } from '@/contexts/privacy-context';
import { AuthProvider } from '@/contexts/auth-context';
import { RequireAuth } from '@/components/auth/require-auth';
import { Layout } from '@/components/layout/layout';
-import { getStoredLastRoute, shouldRestoreRoute } from '@/lib/last-route';
import { Loader2 } from 'lucide-react';
// Eager load: HomePage (initial route) + LoginPage (auth flow)
@@ -48,15 +47,6 @@ function PageLoader() {
);
}
-function HomeEntryRoute() {
- const lastRoute = getStoredLastRoute();
- if (shouldRestoreRoute(lastRoute)) {
- return ;
- }
-
- return ;
-}
-
export default function App() {
return (
@@ -71,7 +61,7 @@ export default function App() {
{/* Protected routes: wrapped with RequireAuth */}
}>
}>
- } />
+ } />
{
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ it('writes pathname with search and hash', () => {
+ storeLastRoute('/accounts', '?tab=auth', '#matrix');
+
+ expect(localStorage.setItem).toHaveBeenCalledWith(
+ LAST_ROUTE_STORAGE_KEY,
+ '/accounts?tab=auth#matrix'
+ );
+ });
+
+ it('writes pathname when search and hash are omitted', () => {
+ storeLastRoute('/health');
+
+ expect(localStorage.setItem).toHaveBeenCalledWith(LAST_ROUTE_STORAGE_KEY, '/health');
+ });
+
+ it('does not throw when localStorage write fails', () => {
+ const setItemSpy = vi.spyOn(Storage.prototype, 'setItem').mockImplementation(() => {
+ throw new Error('quota exceeded');
+ });
+
+ expect(() => storeLastRoute('/providers')).not.toThrow();
+ setItemSpy.mockRestore();
+ });
+});