When I batch edit items in the device/entity list in the UI, the selection is retained after a change is made. However, if I’ve edited an individual item then that disappears from my view (likely) and the previous selection is retained.
Ideally, when you edit a single item, it should remove your selection as you are no longer batch editing.