bvaughn / react-virtualized

React components for efficiently rendering large lists and tabular data
http://bvaughn.github.io/react-virtualized/
MIT License
26.31k stars 3.05k forks source link

React `key` prop is not respected in Table/Column #1725

Closed ZigZagT closed 1 month ago

ZigZagT commented 2 years ago

Bug Report

Code Sandbox Demo

https://user-images.githubusercontent.com/7879714/157403251-7a1c4fcc-744d-4e50-91c6-9b5ed92b1389.mov

The reason behind the weird behavior is because the key property isn't been respected by Table and Column.

Learn more about the key prop

Not breaking the key prop is crucial for many react apps. Please refer Kent C. Dodds' blog post linked above for details about the key property.

What is the current behavior?

The table has a single column of items, each is assigned the key=# property.

To reproduce the bug:

  1. Edit text key=3, change me... to something else
  2. Hit the button of Remove First Row
  3. See the changes you made in 1. is gone

What is the expected behavior?

Expected behavior: The change in the key=3 row should not lost.

Which versions of React and react-virtualized, and which browser / OS are affected by this issue? Did this work in previous versions of react-virtualized?

As of testing:

The issue is OS independent