Skip to content

NVR with realtime local object detection for IP cameras

Handle window resizes in config editor (#19070)

Nicolas Mowenee1db240d7e7
diff --git a/web/src/pages/ConfigEditor.tsx b/web/src/pages/ConfigEditor.tsx
index d13f534763..b8c11d0283 100644
--- a/web/src/pages/ConfigEditor.tsx
+++ b/web/src/pages/ConfigEditor.tsx
@@ -16,6 +16,7 @@ import { MdOutlineRestartAlt } from "react-icons/md";
import RestartDialog from "@/components/overlay/dialog/RestartDialog";
import { useTranslation } from "react-i18next";
import { useRestart } from "@/api/ws";
+import { useResizeObserver } from "@/hooks/resize-observer";
type SaveOptions = "saveonly" | "restart";
@@ -209,6 +210,10 @@ function ConfigEditor() {
};
}, [hasChanges, t]);
+ // layout change handler
+
+ const [{ width, height }] = useResizeObserver(configRef);
+
useEffect(() => {
if (editorRef.current) {
// Small delay to ensure DOM has updated
@@ -218,7 +223,7 @@ function ConfigEditor() {
return () => clearTimeout(timeoutId);
}
- }, [error]);
+ }, [error, width, height]);
if (!config) {
return <ActivityIndicator />;