mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Canvas] Expression input fix. (#121490)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
bf8ced973f
commit
5e174d2b1a
1 changed files with 9 additions and 1 deletions
|
@ -6,10 +6,11 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import React, { useState, useMemo } from 'react';
|
||||
import React, { useState, useMemo, useEffect } from 'react';
|
||||
import { debounce } from 'lodash';
|
||||
|
||||
import type { monaco } from '@kbn/monaco';
|
||||
import usePrevious from 'react-use/lib/usePrevious';
|
||||
|
||||
import { CodeEditor } from '../../../../kibana_react/public';
|
||||
|
||||
|
@ -35,6 +36,13 @@ export const ExpressionInput = (props: ExpressionInputProps) => {
|
|||
...rest
|
||||
} = props;
|
||||
const [expression, setExpression] = useState(initialExpression);
|
||||
const prevExpression = usePrevious(initialExpression);
|
||||
|
||||
useEffect(() => {
|
||||
if (prevExpression !== initialExpression) {
|
||||
setExpression(initialExpression);
|
||||
}
|
||||
}, [prevExpression, initialExpression]);
|
||||
|
||||
const suggestionProvider = useMemo(
|
||||
() => getSuggestionProvider(expressionFunctions),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue