Skip to content

Commit

Permalink
fix(core): fix auto-navigation on route=true searches (#7092)
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherchrisberry authored Jun 11, 2019
1 parent a3e678e commit 0686fd8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export class SearchV2 extends React.Component<{}, ISearchV2State> {
}

public componentDidMount() {
// auto-navigation only happens via shortcut links, and we only do it if there is exactly one result, e.g
// when searching for an instance ID
const autoNavigate = window.location.href.endsWith('route=true');
this.$uiRouter.globals.params$
.map(stateParams => this.getApiFilterParams(stateParams))
.do((params: IQueryParams) => this.setState({ params }))
Expand Down Expand Up @@ -95,9 +98,6 @@ export class SearchV2 extends React.Component<{}, ISearchV2State> {
.takeUntil(this.destroy$)
.subscribe(
resultSets => {
// auto-navigation only happens via shortcut links, and we only do it if there is exactly one result, e.g
// when searching for an instance ID
const autoNavigate = window.location.href.endsWith('route=true');
const finishedSearching = resultSets.map(r => r.status).every(s => s === SearchStatus.FINISHED);
if (finishedSearching && autoNavigate) {
const allResults = resultSets.reduce((acc, rs) => acc.concat(rs.results), []);
Expand Down

0 comments on commit 0686fd8

Please sign in to comment.