petyosi / react-virtuoso

The most powerful virtual list component for React
https://virtuoso.dev
MIT License
5.25k stars 301 forks source link

[BUG] Using custom component List cause the list re-render when data mutated #487

Closed Amethystafyy282 closed 2 years ago

Amethystafyy282 commented 2 years ago

Describe the bug Using custom component List cause the list re-render when data mutated

Reproduction https://codesandbox.io/s/react-virtuoso-forked-fdhhb?file=/src/App.js

To Reproduce 1: Play Audio component 2: Click Add and see the List got re-render

Expected behavior The List not being re-rendered

Screenshots

Desktop (please complete the following information):

petyosi commented 2 years ago

You need to memoize the custom component with hook or move it out of the 'App'.