mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-04 13:47:37 +02:00
Handle window resizes in config editor (#19070)
This commit is contained in:
parent
79655379be
commit
ee1db240d7
@ -16,6 +16,7 @@ import { MdOutlineRestartAlt } from "react-icons/md";
|
|||||||
import RestartDialog from "@/components/overlay/dialog/RestartDialog";
|
import RestartDialog from "@/components/overlay/dialog/RestartDialog";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useRestart } from "@/api/ws";
|
import { useRestart } from "@/api/ws";
|
||||||
|
import { useResizeObserver } from "@/hooks/resize-observer";
|
||||||
|
|
||||||
type SaveOptions = "saveonly" | "restart";
|
type SaveOptions = "saveonly" | "restart";
|
||||||
|
|
||||||
@ -209,6 +210,10 @@ function ConfigEditor() {
|
|||||||
};
|
};
|
||||||
}, [hasChanges, t]);
|
}, [hasChanges, t]);
|
||||||
|
|
||||||
|
// layout change handler
|
||||||
|
|
||||||
|
const [{ width, height }] = useResizeObserver(configRef);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
// Small delay to ensure DOM has updated
|
// Small delay to ensure DOM has updated
|
||||||
@ -218,7 +223,7 @@ function ConfigEditor() {
|
|||||||
|
|
||||||
return () => clearTimeout(timeoutId);
|
return () => clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
}, [error]);
|
}, [error, width, height]);
|
||||||
|
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return <ActivityIndicator />;
|
return <ActivityIndicator />;
|
||||||
|
Loading…
Reference in New Issue
Block a user