react-infinite-scroller icon indicating copy to clipboard operation
react-infinite-scroller copied to clipboard

Rendering a PureComponent triggers a re-render on tracks that were already loaded

Open trymbill opened this issue 6 years ago • 2 comments

See my fork for more detail: https://github.com/trymbill/react-infinite-scroller

I'm using react-infinite-scroller in a pretty detail heavy list and I noticed that when I pushed more results from an API call into the list, all the old results were being re-rendered, even though their props weren't changing (which PureComponent should be taking care of). So I tried replicating it with your demo code and it seems to yield the same result (scrolling down the list with "Highlight Updates" enabled in the React Developer Tools).

This does not happen when the track is added to the list without it going through a React component, but just in a <div> being added right into the list (like you do in your own demo code).

I'm wondering if you could explain why that's happening and/or how to prevent it?

trymbill avatar Oct 01 '18 02:10 trymbill

@trymbill did you ever get a solution to this? I am experiencing something similar.

amcculloughflexera avatar Jan 17 '19 12:01 amcculloughflexera

@amcculloughflexera Unfortunately no. I haven't worked on the project that uses this component in a while, but I'll have to get back to it in a few weeks so I'll start investigating then. I'll report back if I find anything.

trymbill avatar Jan 17 '19 18:01 trymbill