Describe the bug
If I dispatch an action inside the onSelectionChange the selection of rows doesn't work.
To Reproduce
Steps to reproduce the behavior:
Try to check a line:
https://codesandbox.io/s/material-table-with-redux-h3yyx
Expected behavior
The checkbox should be checked
I am getting the same behaviour on a normal table without redux
Example:
https://codesandbox.io/s/material-table-selection-ji7go
@bbouabou I faced same problem. This is because the way react works. When state changes, your component updates itself. So, I changed your code a little bit. Now it works as expected.
Here is the code: https://codesandbox.io/s/material-table-with-redux-0zcom
Push https://codesandbox.io/s/material-table-selection-ji7go
As soon as state is updated by the selection the whole selection is being reset. This is really annoying.
An Idea would be to introduce a table prop which lets us control the selection state. In my point of view this is a missing feature anyway, since there is no way at the moment to select rows programmatically.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.
Most helpful comment
I am getting the same behaviour on a normal table without redux
Example:
https://codesandbox.io/s/material-table-selection-ji7go