#144 Why I am replacing Turbo Frames with Streams for ActsAsVotable?

hotwire turbo streams turbo frames voting

Some server-side rendering problems can be equally solved by either Turbo Frames or Streams.
Each approach has it's cons and pros.

In this scenario I first implemented Voting with Turbo Frames.
This invoked quite a lot of extra context and calculations when calling a separate posts_controller#show action.
So I replaced Frames with Streams that required no extra context outside the current controller action, and explicitly defined the expected server-side rendered HTML (turbo stream) response.

0:00 How ActsAsVotable is set up on Superails.com
3:28 Turbo Frame refreshes vote buttons
4:50 Turbo Frames grabs new context
5:24 Turbo Streams response to replace Frames
8:37 Conclusion: choose the best tool for the job!

Sign in to join the conversation