Skip to content

Commit

Permalink
[APM] Update query input when url changes (#43773)
Browse files Browse the repository at this point in the history
Closes #42135.
  • Loading branch information
dgieselaar authored Aug 23, 2019
1 parent efb27e4 commit 0150c8e
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 0150c8e

Please sign in to comment.