NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Frontend fixes (#22309)
Josh Hawkins889dfca36cd7
diff --git a/web/src/App.tsx b/web/src/App.tsxindex 21babc2b9f..01c415de47 100644--- a/web/src/App.tsx+++ b/web/src/App.tsx@@ -11,7 +11,6 @@ import { Redirect } from "./components/navigation/Redirect";import { cn } from "./lib/utils";import { isPWA } from "./utils/isPWA";import ProtectedRoute from "@/components/auth/ProtectedRoute";-import { AuthProvider } from "@/context/auth-context";import useSWR from "swr";import { FrigateConfig } from "./types/frigateConfig";import ActivityIndicator from "@/components/indicators/activity-indicator";@@ -39,13 +38,11 @@ function App() {return (<Providers>- <AuthProvider>- <BrowserRouter basename={window.baseUrl}>- <Wrapper>- {config?.safe_mode ? <SafeAppView /> : <DefaultAppView />}- </Wrapper>- </BrowserRouter>- </AuthProvider>+ <BrowserRouter basename={window.baseUrl}>+ <Wrapper>+ {config?.safe_mode ? <SafeAppView /> : <DefaultAppView />}+ </Wrapper>+ </BrowserRouter></Providers>);}@@ -85,17 +82,13 @@ function DefaultAppView() {: "bottom-8 left-[52px]",)}>- <Suspense>+ <Suspense+ fallback={+ <ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />+ }+ ><Routes>- <Route- element={- mainRouteRoles ? (- <ProtectedRoute requiredRoles={mainRouteRoles} />- ) : (- <ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />- )- }- >+ <Route element={<ProtectedRoute requiredRoles={mainRouteRoles} />}><Route index element={<Live />} /><Route path="/review" element={<Events />} /><Route path="/explore" element={<Explore />} />diff --git a/web/src/components/auth/ProtectedRoute.tsx b/web/src/components/auth/ProtectedRoute.tsxindex a7d1b3596c..bcfa8fdf36 100644--- a/web/src/components/auth/ProtectedRoute.tsx+++ b/web/src/components/auth/ProtectedRoute.tsx@@ -10,7 +10,7 @@ import {export default function ProtectedRoute({requiredRoles,}: {- requiredRoles: string[];+ requiredRoles?: string[];}) {const { auth } = useContext(AuthContext);@@ -36,6 +36,13 @@ export default function ProtectedRoute({);}+ // Wait for config to provide required roles+ if (!requiredRoles) {+ return (+ <ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />+ );+ }+if (auth.isLoading) {return (<ActivityIndicator className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2" />diff --git a/web/src/components/overlay/ActionsDropdown.tsx b/web/src/components/overlay/ActionsDropdown.tsxindex d73ae71e34..9ddb0bd353 100644--- a/web/src/components/overlay/ActionsDropdown.tsx+++ b/web/src/components/overlay/ActionsDropdown.tsx@@ -20,7 +20,7 @@ export default function ActionsDropdown({const { t } = useTranslation(["components/dialog", "views/replay", "common"]);return (- <DropdownMenu>+ <DropdownMenu modal={false}><DropdownMenuTrigger asChild><ButtonclassName="flex items-center gap-2"diff --git a/web/src/hooks/use-user-persistence.ts b/web/src/hooks/use-user-persistence.tsindex 519a8aa5a2..15d8191737 100644--- a/web/src/hooks/use-user-persistence.ts+++ b/web/src/hooks/use-user-persistence.ts@@ -116,6 +116,11 @@ export function useUserPersistence<S>(return;}+ // Skip reload if we're already loaded for this key+ if (loadedKeyRef.current === namespacedKey) {+ return;+ }+// Reset state when key changes - this prevents stale writesloadedKeyRef.current = null;migrationAttemptedRef.current = false;diff --git a/web/src/utils/i18n.ts b/web/src/utils/i18n.tsindex 242e09e92b..16de6dc405 100644--- a/web/src/utils/i18n.ts+++ b/web/src/utils/i18n.ts@@ -40,23 +40,31 @@ i18n"common","objects","audio",+ "components/auth","components/camera","components/dialog","components/filter","components/icons",+ "components/input","components/player",- "views/events","views/chat",+ "views/classificationModel",+ "views/configEditor",+ "views/events","views/explore",+ "views/exports",+ "views/faceLibrary","views/live",+ "views/motionSearch",+ "views/recording",+ "views/replay",+ "views/search","views/settings","views/system",- "views/exports",- "views/explore",- "config/global","config/cameras",- "config/validation",+ "config/global","config/groups",+ "config/validation",],defaultNS: "common",