Skip to content

NVR with realtime local object detection for IP cameras

refresh editor value when config is updated (#11559)

Josh Hawkinsc07f6999ca57
diff --git a/web/src/pages/ConfigEditor.tsx b/web/src/pages/ConfigEditor.tsx
index ea89d32fbd..55df04e343 100644
--- a/web/src/pages/ConfigEditor.tsx
+++ b/web/src/pages/ConfigEditor.tsx
@@ -29,7 +29,7 @@ function ConfigEditor() {
const [error, setError] = useState<string | undefined>();
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(null);
- const modelRef = useRef<monaco.editor.IEditorModel | null>(null);
+ const modelRef = useRef<monaco.editor.ITextModel | null>(null);
const configRef = useRef<HTMLDivElement | null>(null);
const onHandleSaveConfig = useCallback(
@@ -124,6 +124,12 @@ function ConfigEditor() {
};
});
+ useEffect(() => {
+ if (config && modelRef.current) {
+ modelRef.current.setValue(config);
+ }
+ }, [config]);
+
if (!config) {
return <ActivityIndicator />;
}