Fix the view more/less functionality by properly reporting the total number of claims (#530)
This commit is contained in:
parent
f0fdcb6a6e
commit
350524114a
1 changed files with 5 additions and 2 deletions
|
@ -91,13 +91,16 @@ export default function ClaimList(props: Props) {
|
||||||
|
|
||||||
let tileUris = (prefixUris || []).concat(uris || []);
|
let tileUris = (prefixUris || []).concat(uris || []);
|
||||||
tileUris = tileUris.filter((uri) => !excludeUris.includes(uri));
|
tileUris = tileUris.filter((uri) => !excludeUris.includes(uri));
|
||||||
|
|
||||||
|
const totalLength = tileUris.length;
|
||||||
|
|
||||||
if (maxClaimRender) tileUris = tileUris.slice(0, maxClaimRender);
|
if (maxClaimRender) tileUris = tileUris.slice(0, maxClaimRender);
|
||||||
|
|
||||||
let sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? tileUris : tileUris.slice().reverse())) || [];
|
let sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? tileUris : tileUris.slice().reverse())) || [];
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (typeof loadedCallback === 'function') loadedCallback(tileUris.length || 0);
|
if (typeof loadedCallback === 'function') loadedCallback(totalLength);
|
||||||
}, [tileUris.length]); // eslint-disable-line react-hooks/exhaustive-deps
|
}, [totalLength]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
const noResultMsg = searchInLanguage
|
const noResultMsg = searchInLanguage
|
||||||
? __('No results. Contents may be hidden by the Language filter.')
|
? __('No results. Contents may be hidden by the Language filter.')
|
||||||
|
|
Loading…
Reference in a new issue