Skip to content

Changing state with setState in onRowExpand collapses the expanded row #989

@keybraker

Description

@keybraker

All three versions try to showcase a general problem in the functionality of expandable rows. I was trying to make the program call for a get request from server and update the state of the data in the current expandable row. But although fetching the data correctly and storing it, and being displayed on screen for a second the setState itself was the cause that collapsed the expanded row.

As shown bellow three different ways that a setState is being called cause the same problem to occur.

[1]
onTableChange: (action, tableState) => { switch (action) { case 'expandRow': this.setState({age: 1}) break; default: break; } }

[2]
onRowsExpand: (curExpanded, allExpanded) => { this.setState({age: 1}) }

[3]
onRowClick: (rowData, rowState) => { this.setState({age: 1}) }

Metadata

Metadata

Labels

bugv4 state/propsThis issue is related to state and props attempting to control the same values

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions