🐛 Corrige le tri des règles selon la page courrante

pull/878/head
Loïc Guillois 2020-02-25 12:07:26 +01:00
parent 12de693413
commit 85b2bcd7b3
1 changed files with 2 additions and 3 deletions

View File

@ -90,8 +90,7 @@ export default function SearchBar({
let renderOptions = (rules?: Array<Rule>) => {
const currentPage = getDottedName(window.location.href)
let options =
(rules && sortBy(rule => rule.dottedName, rules)) || take(5)(results)
let options = (rules && sortBy(rule => rule.dottedName, rules)) || results
let currentOptions: Array<Pick<Rule, 'dottedName'>> = []
let notCurrentOptions: Array<Pick<Rule, 'dottedName'>> = []
options.forEach(option => {
@ -103,7 +102,7 @@ export default function SearchBar({
})
return (
<ul>
{[...currentOptions, ...notCurrentOptions].map((option, idx) =>
{take(5)([...currentOptions, ...notCurrentOptions]).map((option, idx) =>
renderOption(option, idx)
)}
</ul>