fix totalCount getting an array instead of a number (#5359)

This commit is contained in:
Mehdi Vasigh 2020-01-09 08:47:55 -06:00 committed by Ben Halpern
parent 373140d3d1
commit 29a734b698

View file

@ -102,12 +102,13 @@ export function search(query, { page, tags, statusView }) {
}
index.search(query, filters).then(result => {
// append new items at the end
const allItems = page === undefined ? result.hits : [...items, ...result.hits];
const allItems =
page === undefined ? result.hits : [...items, ...result.hits];
component.setState({
query,
page: newPage,
items: result.hits,
totalCount: allItems,
totalCount: allItems.length,
// show the button if the number of items is lower than the number
// of available results
showLoadMoreButton: allItems.length < result.nbHits,