Skip to content

Adds turbo stream to the discard button jobs#270

Closed
TimeTravelerFromNow wants to merge 1 commit intorails:mainfrom
TimeTravelerFromNow:main
Closed

Adds turbo stream to the discard button jobs#270
TimeTravelerFromNow wants to merge 1 commit intorails:mainfrom
TimeTravelerFromNow:main

Conversation

@TimeTravelerFromNow
Copy link
Copy Markdown
Contributor

@TimeTravelerFromNow TimeTravelerFromNow commented Jul 9, 2025

Fixes issue #161 where the full refresh would clear the current job class filter, uses turbo-stream true on the discard button to remove the table row without hard refresh.

Solution

This is a proof of concept using turbo streams, because we would like @rosa 's feedback on the approach.
An alternative solution is passing the current parameters into the discard button like so, but this has it's drawbacks as well.

Steps to test

  • Create some failed jobs of separate classes
  • Apply the filter in the view
  • Discard a job, check that it is deleted successfully and is removed from the view
  • The filter for the job class remains

Known issues

  • This PR doesnt update the count of filtered jobs on the view, because it skips re-render.
Screenshot 2025-07-09 at 2 16 32 PM

This can be solved by updating the count as well using the turbo_stream .replace method within a turbo_stream.html
If we want to go forward with this approach, we should fix this known issue and add test coverage

  • The flash doesnt render (also Todo)

Fixes issue #161 where the full refresh would clear the current job class filter, uses turbo to remove the table row instead of full refresh

Co-authored-by: Yuri Bocharov <mail@yuribocharov.dev>
@rosa
Copy link
Copy Markdown
Member

rosa commented Jul 11, 2025

Thanks a lot, @TimeTravelerFromNow! I like this approach a lot! Better than #272, great idea! If you're up for it, feel free to finish this with the fixes for the job count and the flash. If not, no worries, happy to help bringing this up to the finish line.

@rosa
Copy link
Copy Markdown
Member

rosa commented Jul 11, 2025

Wait, maybe, thinking about it again, #272 is better, but with some refinements. Hold on about this one 🙏

@rosa
Copy link
Copy Markdown
Member

rosa commented Jul 11, 2025

Closing this one as #272 has been merged now 🥳 Thanks again!

@rosa rosa closed this Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants