Don't run filters unless necessary
The loop was executed over the entire `tileUris` regardless of whether `excludeUris` existed.
This commit is contained in:
parent
c4d6fa9ff0
commit
e634c728f0
1 changed files with 6 additions and 2 deletions
|
@ -114,14 +114,18 @@ export default function ClaimList(props: Props) {
|
||||||
const urisLength = (uris && uris.length) || 0;
|
const urisLength = (uris && uris.length) || 0;
|
||||||
|
|
||||||
let tileUris = (prefixUris || []).concat(uris || []);
|
let tileUris = (prefixUris || []).concat(uris || []);
|
||||||
tileUris = tileUris.filter((uri) => !excludeUris.includes(uri));
|
|
||||||
|
if (excludeUris && excludeUris.length) {
|
||||||
|
tileUris = tileUris.filter((uri) => !excludeUris.includes(uri));
|
||||||
|
}
|
||||||
|
|
||||||
if (prefixUris && prefixUris.length) tileUris.splice(prefixUris.length * -1, prefixUris.length);
|
if (prefixUris && prefixUris.length) tileUris.splice(prefixUris.length * -1, prefixUris.length);
|
||||||
|
|
||||||
const totalLength = tileUris.length;
|
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())) || [];
|
const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? tileUris : tileUris.slice().reverse())) || [];
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (typeof loadedCallback === 'function') loadedCallback(totalLength);
|
if (typeof loadedCallback === 'function') loadedCallback(totalLength);
|
||||||
|
|
Loading…
Reference in a new issue