nerves-hub / nerves_hub_web

Manage firmware updates for Nerves devices
https://nerves-hub.org/
Apache License 2.0
179 stars 72 forks source link

Device selections remain even when filter filters the selected devices out #1475

Open fhunleth opened 3 weeks ago

fhunleth commented 3 weeks ago

Describe the bug Devices can remain selected when changing the filter and that makes it easy to accidentally apply a bulk action to a hidden device.

To Reproduce Steps to reproduce the behavior:

  1. Go to the devices page and select a few devices
  2. Update the filter so that those devices won't show
  3. See that the selected device count next to the "Bulk actions" text stays the same
  4. Now select a few more devices

Expected behavior I'm not sure how other UIs handle this issue, but I found this surprising when I first noticed it. I was enabling firmware updates at the time so this was harmless, but I didn't realize until pretty late in the process that I was re-enabling firmware updates on devices that I had selected a long time ago.

joshk commented 3 weeks ago

Ahhhh, this is due to a funky way the device selection works.

We store the selected devices in the LiveView, as they are added. If we switched to using a more form based approach, then this wouldn't be an issue.

I think the quick fix is to wipe all selected devices when the filters are changed.