diff --git a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx index 655834f49ca9fc..dd891b42f6856c 100644 --- a/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx +++ b/src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { CSSProperties, useEffect, useRef, useState } from 'react'; +import React, { CSSProperties, useCallback, useEffect, useRef, useState } from 'react'; import { EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -143,7 +143,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) { }; }, []); - const sendCurrentRequestToES = () => { + const sendCurrentRequestToES = useCallback(() => { dispatch({ type: 'sendRequestToEs', value: { @@ -153,7 +153,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) { history.addToHistory(esPath, esMethod, esData), }, }); - }; + }, [settings]); useEffect(() => { applyCurrentSettings(editorInstanceRef.current!, settings); @@ -167,7 +167,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) { sendCurrentRequestToES, openDocumentation, }); - }, []); + }, [sendCurrentRequestToES]); return (