From de5ff19b8b7725fa37e4cbaf59b231ae7b789d69 Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Wed, 3 Aug 2022 14:47:09 +0300 Subject: [PATCH] fix: search and navigate error --- src/components/SearchBox/SearchBox.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx index d6122362..9f78826e 100644 --- a/src/components/SearchBox/SearchBox.tsx +++ b/src/components/SearchBox/SearchBox.tsx @@ -132,12 +132,13 @@ export class SearchBox extends React.PureComponent ({ - 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 (