();
+ 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;
+ }
+ }}
/>
diff --git a/yarn.lock b/yarn.lock
index 4f2c8029b..5c963f485 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -10560,10 +10560,10 @@ react-zoom-pan-pinch@^2.1.3:
resolved "https://registry.yarnpkg.com/react-zoom-pan-pinch/-/react-zoom-pan-pinch-2.6.1.tgz#5719fdd9515dc1f379a23350cbf99edd540b1281"
integrity sha512-4Cgdnn6OwN4DomY/E9NpAf0TyCtslEgwdYn96ZV/f5LKuw/FE3gcIBJiaKFmMGThDGV0yKN5mzO8noi34+UE4Q==
-react@^18.2.0:
- version "18.2.0"
- resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
- integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
+react@18.3:
+ version "18.3.1"
+ resolved "https://registry.yarnpkg.com/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
+ integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
dependencies:
loose-envify "^1.1.0"