Content
View differences
Updated by Attila Dombi 2 days ago
In order to always render the correct state after actions on the backlogs page, the filter state params are passed in the url for each action. This implementation has a few shortcomings:
* Prevents the WorkPackageCardComponents to be cacheable, because the component's urls also encode the filter params that can change on the fly.
* It adds a layer of complexity by passing the filter params to each url and action on the page.
The solution for both issues is to avoid passing the filter params around.
This can be achieved via changing the controller actions behaviour to not update every component that's changed, but rather just send a signal to the frontend to update itself.
The TurboPower gem provides a custom turbo StreamAction called `turbo_stream.turbo_frame_reload(target)` that can solve this exact problem.
An additional benefit of this approach is that, it greatly DRYes up the controller actions too. Instead of building and sending all the updated components from each action, the response just sends a message to the frontend to update itself.
<br>
* Prevents the WorkPackageCardComponents to be cacheable, because the component's urls also encode the filter params that can change on the fly.
* It adds a layer of complexity by passing the filter params to each url and action on the page.
The solution for both issues is to avoid passing the filter params around.
This can be achieved via changing the controller actions behaviour to not update every component that's changed, but rather just send a signal to the frontend to update itself.
The TurboPower gem provides a custom turbo StreamAction called `turbo_stream.turbo_frame_reload(target)` that can solve this exact problem.
An additional benefit of this approach is that, it greatly DRYes up the controller actions too. Instead of building and sending all the updated components from each action, the response just sends a message to the frontend to update itself.
<br>