We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f7cb77 commit 82f734fCopy full SHA for 82f734f
packages/homepage/src/screens/home/NPMFeature/SearchInput/index.js
@@ -39,7 +39,19 @@ export default class SearchInput extends React.PureComponent {
39
40
searchQuery = (query: string) => {
41
searchFacets('npm_dependencies.dependency', query).then(res => {
42
- this.setState({ hits: res.facetHits.slice(0, 3) });
+ const { facetHits } = res;
43
+
44
+ facetHits.sort((a, b) => {
45
+ if (a.value === query) {
46
+ return -1;
47
+ } else if (b.value === query) {
48
+ return 1;
49
+ }
50
51
+ return 0;
52
+ });
53
54
+ this.setState({ hits: facetHits.slice(0, 3) });
55
});
56
};
57
0 commit comments