civiccc / civiccc/react-waypoint

Triggers infinitely when placed in an array

Open
#366 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

Hello,

Waypoint is already used on my project, I tried to implement it inside a table (with Material UI). The onEnter action then fires infinitely.

But if I remove the scroll from the table, and leave the browser's default scroll and place the Waypoint tag outside the table, the bug no longer occurs and everything works normally.

I wonder if it's due to react-waypoint or material-ui

Here is my code below, there are probably unnecessary rendering conditions, since I tested several things before realizing where the bug came from

```
const handleEnter = () => {
setQueryProps(({ page_size }) => ({
page_size,
next_token: data?.next_token,
query_execution_id: data?.query_execution_id,
}));
};

return (
<>

Reporting





{tableHeaders.map(({ accessor, label }) => (

{label}

))}


{reportList.map((item: ReportItemType) => (

{tableHeaders.map(({ accessor }) => (

{item[accessor]}

))}

))}
{isLoading && (

)}
{!isLoading &&
hasNextPage &&
!error &&
reportList.length > 0 &&
page > 0 && (



)}







);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.