DataTable with Selection: fails to update selections when rows update
See original GitHub issueWhat package(s) are you using?
-
carbon-components
v10.12.0
-
carbon-components-react
v7.12.0
Detailed description
Describe in detail the issue you’re having.
When rendering a DataTable
with a selection column, the rows’ selection cannot be updated after the initial render.
This seems to be due to the override of the isSelected
field from the existing state’s value if the row’s ID already exists in the table.
Is this issue related to a specific component?
DataTable with Selection.
What did you expect to happen? What happened instead? What would you like to see changed?
The DataTable
should react to the input’s data: if the rows’ isSelected
property is updated and the Table is rerendered, the table should not override the isSelected
with a possibly stale value.
What browser are you working in?
Google Chrome
What offering/product do you work on? Any pressing ship or release dates we should be aware of?
The product is to be released at the end of June 2020.
Steps to reproduce the issue
https://codesandbox.io/s/nifty-germain-2emx2?file=/src/index.js
Issue Analytics
- State:
- Created 3 years ago
- Reactions:17
- Comments:6 (5 by maintainers)
Top GitHub Comments
However, I have to ask: Why support (mutable) selection if there isn’t an easy, supported way to communicate that selection out of the table’s internal state?
https://github.com/carbon-design-system/carbon/issues/6260
Is there still no fix planned for this? This bug still affects Carbon v11 and makes the selection feature in data tables somewhat moot when you can’t easily access the internal selection state either.