I can see that the $selected property is correctly updated with the selected tasks when outputting @json($selected).
However I have the following issue:
I select 1/multiple task checkboxes.
I then click a hyperlink to visit the task show page (separate page).
Clicking the browser back button, the $selected array is empty (as expected) , however the selected checkboxes are still checked.
If I manually refresh the page in the browser then everything resets as expected.
I can set autocomplete="off" against the HTML checkbox, but this doesn't feel right and unsure why the checkboxes are not unchecked matching the $selected property which is now an empty array?
just wire the checkbox. Do not also set the value. The checked or unchecked state will reflect the state in the component. As it is, you are trying to set state on both sides at once.
This may not solve your issue, but it will prevent other odd effects.
The problem is that when you press back, the browser renders the page in its last state without even calling the component.