Skip to content

Commit

Permalink
fix: search and navigate error
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVarchuk committed Aug 10, 2022
1 parent 4dbde2b commit cfd810f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/SearchBox/SearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ export class SearchBox extends React.PureComponent<SearchBoxProps, SearchBoxStat

render() {
const { activeItemIdx } = this.state;
const results = this.state.results.map(res => ({
item: this.props.getItemById(res.meta)!,
score: res.score,
}));

results.sort((a, b) => b.score - a.score);
const results = this.state.results
.filter(res => this.props.getItemById(res.meta))
.map(res => ({
item: this.props.getItemById(res.meta)!,
score: res.score,
}))
.sort((a, b) => b.score - a.score);

return (
<SearchWrap role="search">
Expand Down

0 comments on commit cfd810f

Please sign in to comment.