ember-table icon indicating copy to clipboard operation
ember-table copied to clipboard

restoring selection when rows are "new" does not behave as expected

Open efx opened this issue 6 years ago • 2 comments

I am revisiting #624 as I have found a valid case where this is a problem. If you implement a search combined with the selection behavior, selections will not restore properly. I think this stems from the equality check done by `isGroupSelection. To see this reproduced,

  1. git clone --branch=topic-ember-table-bug [email protected]:efx/poc-bug.git

  2. npm install, ember serve

  3. select a couple rows screen shot 2018-12-19 at 10 09 20

  4. search for a nonsense name value

  5. clear the search value

  6. you should see your selections are gone

screen shot 2018-12-19 at 10 10 36

I think this is from setting the rows to a new array of objects. I would expect my selections to be restored as the values are essentially equal even if the JavaScript data structures equality is falsey. Additionally, the selection property contains duplicate rows after these steps. @gwak you may find this pertinent.

efx avatar Dec 19 '18 15:12 efx

the `selection property contains duplicate rows after these steps

I think this results from using Set to store the objects. The equality checks will always return different.

ghost avatar Dec 19 '18 16:12 ghost

I can fix this by substituting an identity function here. This seems like a feature, so I'll defer to discussion before opening a PR. You can find me on ember discord as well.

ghost avatar Dec 19 '18 18:12 ghost