();
+ const wrapperRef = React.useRef(null);
+
const [valid, setValid] = React.useState(true);
const handleChange = (editor: any, data: any, value: string) => {
@@ -42,15 +45,32 @@ const ElasticSearchQueryInput: React.FunctionComponent<{
{
+ (editorRef as React.MutableRefObject<
+ codemirror.Editor
+ >).current = editorElement;
+ }}
+ editorWillUnmount={() => {
+ (editorRef as React.MutableRefObject).current
+ .getWrapperElement()
+ ?.remove();
+ if (wrapperRef.current) {
+ (wrapperRef.current as { hydrated: boolean }).hydrated = false;
+ }
+ }}
/>