Skip to content

Commit

Permalink
[APM] Update query input when url changes (elastic#43773) (elastic#43854
Browse files Browse the repository at this point in the history
)

Closes elastic#42135.
  • Loading branch information
dgieselaar authored Aug 24, 2019
1 parent ec357c5 commit 1fd8a77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ export class Typeahead extends Component {
isSuggestionsVisible: false,
index: null,
value: '',
inputIsPristine: true
initialValue: ''
};

static getDerivedStateFromProps(props, state) {
if (state.inputIsPristine && props.initialValue) {
const { initialValue } = props;
if (initialValue && initialValue !== state.initialValue) {
return {
value: props.initialValue
value: initialValue,
initialValue
};
}

Expand Down Expand Up @@ -125,7 +127,6 @@ export class Typeahead extends Component {
const hasValue = Boolean(value.trim());
this.setState({
value,
inputIsPristine: false,
isSuggestionsVisible: hasValue,
index: null
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export function KueryBar() {
return;
}

history.replace({
history.push({
...location,
search: fromQuery({
...toQuery(location.search),
Expand Down

0 comments on commit 1fd8a77

Please sign in to comment.