Skip to content

Commit

Permalink
Fix stale value in editor shortcut command (#48484) (#48531)
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens authored Oct 17, 2019
1 parent b78273a commit 0a6a456
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -143,7 +143,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) {
};
}, []);

const sendCurrentRequestToES = () => {
const sendCurrentRequestToES = useCallback(() => {
dispatch({
type: 'sendRequestToEs',
value: {
Expand All @@ -153,7 +153,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) {
history.addToHistory(esPath, esMethod, esData),
},
});
};
}, [settings]);

useEffect(() => {
applyCurrentSettings(editorInstanceRef.current!, settings);
Expand All @@ -167,7 +167,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) {
sendCurrentRequestToES,
openDocumentation,
});
}, []);
}, [sendCurrentRequestToES]);

return (
<div style={abs} className="conApp">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

interface Actions {
input: any;
input: any; // TODO: Wrap this in an editor interface
sendCurrentRequestToES: () => void;
openDocumentation: () => void;
}
Expand Down

0 comments on commit 0a6a456

Please sign in to comment.