TIL
Sometimes we learn stuff and we share it with you fine people.
Back to all blog posts
-
· Barry Hess · TIL
TIL: Turbo Frames
DoEvery.Day calendar navigation was broken. We built it using Turbo Rails as it was being developed. As we have updated libraries, including Rails, the API has changed. In order to get the calendar navigation working again, I had to pull out some old hacks that made use of
turbo_stream_action_tag
via Turbo Streams to get my Turbo Frames working. The code is a bit more straightforward now, though I find Turbo Frames to feel a little too magical.Turbo Frames Vs. Turbo Streams gave me my first hints at how to fix things up, but the example request flow was a little too odd for me to absorb. Turbo Frames and Turbo Stream templates ended up explaining things well enough that I could get the issue resolved.
I ended up in this PR to re-discover how a Turbo-Frame-based request can update the browser’s URL. In this case that’s
data-turbo-action
, which in practice looks something like:link_to("My Link", my_path(data: { turbo_frame: "tf_calendar", turbo_action: :advance })