bvaughn / react-virtualized

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

Changing column count generates error on MultiGrid #1351

Open jdt3969 opened 5 years ago

jdt3969 commented 5 years ago

Asking a Question?

Please don't file GitHub issues to ask questions! Instead use:

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Sandbox: Code Sandbox Click the button to see the bug: Requested index 0 is outside of range 0..0

start state is:

fixedColumnCount: 1,
fixedRowCount: 1,
columnCount: 2,
rowCount: 1

When clicking on the button, it adjusts columnCount from 2 to 1 and triggers the error.

The bug exists when columns use variable widths for columns: columnWidth={({ index }) => widths[index]}

but not when using fixed widths: columnWidth={({ index }) => 100}

What is the expected behavior?

There should be no error and this should be a valid state transition

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?

Browser Chrome
OS Mac
React 16.8.3
React DOM 16.8.3
react-virtualized 9.21.0
DaanVandenBosch commented 5 years ago

This bug only seems to occur when you return a columnWidth that is not a multiple of 100 (try returning 45 hardcoded) and when the columnCount becomes equal to the fixedColumnCount after being larger.