forked from Github/frigate
refresh editor value when config is updated (#11559)
This commit is contained in:
@@ -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 />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user