diff --git a/src/modules/EditorView/VariablesEditor.tsx b/src/modules/EditorView/VariablesEditor.tsx index 144b7135..a79f95be 100644 --- a/src/modules/EditorView/VariablesEditor.tsx +++ b/src/modules/EditorView/VariablesEditor.tsx @@ -29,6 +29,7 @@ import { drawSelection, dropCursor, EditorView, highlightSpecialChars, keymap, l import { dracula, tomorrow } from "@mjfwebb/thememirror"; import { Button } from "@neo4j-ndl/react"; import classNames from "classnames"; +import { useMount } from "react-use"; import type { Extension } from "../../components/Filename"; import { FileName } from "../../components/Filename"; @@ -106,7 +107,7 @@ export const VariablesEditor = ({ id, loading, fileExtension, fileName, borderRa [formatTheCode, theme.theme, updateListener] ); - useEffect(() => { + useMount(() => { if (elementRef.current === null) { return; } @@ -123,7 +124,7 @@ export const VariablesEditor = ({ id, loading, fileExtension, fileName, borderRa view.destroy(); setEditorView(null); }; - }, [value]); + }); useEffect(() => { if (editorView) { @@ -163,6 +164,7 @@ export const VariablesEditor = ({ id, loading, fileExtension, fileName, borderRa rightButtons={