Ruby on Rails #144 Why I am replacing Turbo Frames with Streams for ActsAsVotable?
about 1 month ago
·
Sign in to track your progress
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!
Featured in playlist:
Recommended based on what you are watching now:

06:30
Ruby on Rails #143 Turbo Permanent: persist Audio Video and Search results while navigating pages

24:13
Rails 7 E110 Realtime Online User Tracking with Actioncable, Kredis, Turbo Broadcasts

22:01
Rails 7 E109 Live vistor count. ActionCable, Turbo Broadcasts, Kredis

16:43
Ruby on Rails #100 Browser tab title notifications

24:20