mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
refresh editor value when config is updated (#11559)
This commit is contained in:
parent
eca8c52f15
commit
c07f6999ca
@ -29,7 +29,7 @@ function ConfigEditor() {
|
|||||||
const [error, setError] = useState<string | undefined>();
|
const [error, setError] = useState<string | undefined>();
|
||||||
|
|
||||||
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(null);
|
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 configRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
const onHandleSaveConfig = useCallback(
|
const onHandleSaveConfig = useCallback(
|
||||||
@ -124,6 +124,12 @@ function ConfigEditor() {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (config && modelRef.current) {
|
||||||
|
modelRef.current.setValue(config);
|
||||||
|
}
|
||||||
|
}, [config]);
|
||||||
|
|
||||||
if (!config) {
|
if (!config) {
|
||||||
return <ActivityIndicator />;
|
return <ActivityIndicator />;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user