-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Table] Fix deselect all logic #5249
Conversation
Remove logic where last TableRow was selected when deselecting all items. Fixes mui#5234.
Fix logic where clicking on a row when all items are selected deselects everything but the last TableRow
The |
Why is that closed? Today is 13th December and the bug is still there. What is the downside of merging this PR? |
@NZhuravlev I don't have much context on this component. That was simply too time-consuming for me to review it. It would be much better with unit tests to make sure about the expected behavior. Anyone from @callemall/material-ui wants to have a look at it? Two people interested in the same change has a good noise vs signal rate :). |
Digging into that issue, it seems that the following piece of logic is coming out of nowhere. this.setState({
selectedRows: this.state.selectedRows.length > 0 ?
[this.state.selectedRows[this.state.selectedRows.length - 1]] : [],
}); However, I'm wondering, why not changing that logic for the following one: #4588? @umidbekkarimov any light 💡 on why you closed your PR? Thanks |
@oliviertassinari not sure why (yeah i should have leave a note) but i think there was another problems with state management, so I decided to use my own implementation for checkboxes with more control instead of native one |
@oliviertassinari I have the same issue, and I have created a PR for this, can you please merge this PR, thank you!! |
I though both PR are fixing the same issue. I took the one that looks simpler. |
The other change is for
With this change, clicking on a row when all rows are selected (using select all), that row gets de-selected, which I believe is the expected behaviour. I'm not sure if merging #5829 fixed this issue as well, as I am away from a laptop. If it did, feel free to skip over this. Thanks! |
@vividh That's not the current behavior, but I agree. That should be the default behavior. |
Aware of #3980 and #4588. Since #2251 talks about implementing a completely new
Table
component set, and no clear ETA of a fix forTable
in 0.16.0, this could fix major woes with the existingTable
component and hopefully solve many users' issues.