From 29a734b69824675ac09e906ad7f5546c775344f4 Mon Sep 17 00:00:00 2001 From: Mehdi Vasigh Date: Thu, 9 Jan 2020 08:47:55 -0600 Subject: [PATCH] fix totalCount getting an array instead of a number (#5359) --- app/javascript/searchableItemList/searchableItemList.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/searchableItemList/searchableItemList.js b/app/javascript/searchableItemList/searchableItemList.js index fe8018b72..dca05149d 100644 --- a/app/javascript/searchableItemList/searchableItemList.js +++ b/app/javascript/searchableItemList/searchableItemList.js @@ -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,