use-selected-items-hook icon indicating copy to clipboard operation
use-selected-items-hook copied to clipboard

Toggle all should select all or deselect all items in the list

Open jithureddy opened this issue 2 years ago • 1 comments

First of all this is really good library and custom hook well implemented. 🎉 👍 💯

Steps to reproduce the issue

  1. Go to https://use-selected-items-hook.vercel.app/
  2. Click on one item, it is selected - which is good
  3. Click on toggle all
  4. 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 👍 image

Then clicked on toggle all link on the top image

jithureddy avatar Feb 01 '22 19:02 jithureddy

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

LauraBeatris avatar Feb 02 '22 11:02 LauraBeatris