use-selected-items-hook
use-selected-items-hook copied to clipboard
Toggle all should select all or deselect all items in the list
First of all this is really good library and custom hook well implemented. 🎉 👍 💯
Steps to reproduce the issue
- Go to https://use-selected-items-hook.vercel.app/
- Click on one item, it is selected - which is good
- Click on toggle all
- See the previously selected item is unselected and remaining all selected
What I expected
I would expect all of the items are selected and then if toggle all is clicked, all list items should be unselected. Consider there is a table and each row has checkbox, then I would select all using toggle then all of the rows must be selected.
Screenshots
One item selected 👍
Then clicked on toggle all link on the top
Hey @jithureddy, thanks for creating this issue!
I think that the current behavior is correct but there are use cases, like the one you mentioned, in which all
should be selected/unselected together, if there's only one selected from the moment of the trigger
Putting in another words, at the moment, we're literally toggling the state now, but maybe we can provide an argument to explicitly state that all values should be selected and unselected together