ClaimList: fix infinite effect loop (#1523)
`tileUris` is being used as an effect dependency, but it gets re-created on every render (same content, different reference), so the `setUriBuffer` effect ended up in a loop.
This commit is contained in:
parent
b0b2056d78
commit
855d3dae01
1 changed files with 7 additions and 5 deletions
|
@ -119,14 +119,16 @@ export default function ClaimList(props: Props) {
|
||||||
const timedOut = uris === null;
|
const timedOut = uris === null;
|
||||||
const urisLength = (uris && uris.length) || 0;
|
const urisLength = (uris && uris.length) || 0;
|
||||||
|
|
||||||
let tileUris = (prefixUris || []).concat(uris || []);
|
const tileUris = React.useMemo(() => {
|
||||||
|
const x = (prefixUris || []).concat(uris || []);
|
||||||
if (prefixUris && prefixUris.length) tileUris.splice(prefixUris.length * -1, prefixUris.length);
|
if (prefixUris && prefixUris.length) {
|
||||||
|
x.splice(prefixUris.length * -1, prefixUris.length);
|
||||||
|
}
|
||||||
|
return maxClaimRender ? x.slice(0, maxClaimRender) : x;
|
||||||
|
}, [prefixUris, uris, maxClaimRender]);
|
||||||
|
|
||||||
const totalLength = tileUris.length;
|
const totalLength = tileUris.length;
|
||||||
|
|
||||||
if (maxClaimRender) tileUris = tileUris.slice(0, maxClaimRender);
|
|
||||||
|
|
||||||
const 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(() => {
|
||||||
|
|
Loading…
Reference in a new issue