twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.85k stars 487 forks source link

Placeholder memory leak #326

Closed N00nDay closed 3 years ago

N00nDay commented 3 years ago

The problem When I am using placeholder I am getting a Detached HTMLDivElement for each one. This is a significant leak in my case as some plages can have almost 1000+ placeholders.

Steps to reproduce Add LazyLoad to a long list with the placeholder prop. Before opening the list take a Heap snapshot. Open the list, scroll to the bottom and take another Heap snapshot. Check the difference between the two Heap snapshots and you will see that for every placeholder there is a Detached HTMLDivElement.

Expected behavior There wouldn't be any detached notes.

Props being used overflow resize once offset={600} height={ a.images.length === 0 ? 160 : 460 } placeholder={ <div>I am Loading...</div> } scrollContainer={"#feed-container"}