Fix: board columns actions are stale when moving a column moves
Problem
When creating or destroying a column or moving it either right or left, the views/boards/show/menu/_column_form.html.erb partial of already existing columns is stale, so the action buttons inside the form are either disabled or actionable when should not be the case.
How to reproduce
- Create a new board and navigate to it.
- Create a new column.
- Create another column.
- Expand the first created column by clicking on it.
- Open the action menu by clicking on the ellipsis icon.
- The action button to move it right is disabled although it can be moved right.
- Delete the first created column.
- Expand the second created column.
- Open the action menu by clicking on it.
- The action button to move the column left is still enabled, even though there is nothing to the left side.
Demonstration video
https://github.com/user-attachments/assets/d43090e7-0870-447a-9b24-903e2181de44
Solution
Refresh board columns on move right/left and create/destroy actions. I extracted the update logic into the views/columns/_refresh_surroundings.turbo_stream.erb which is rendered by other streams.
Hey @jorgemanrubia thank you for reviewing! Just made the changes you've requested, and fixed the bug referenced in the issue. Here's how it looks:
https://github.com/user-attachments/assets/730a17f2-7fb7-435c-9b7f-b1154f57aad8