#152 Custom Turbo Streams. How to redirect from a form that is inside a turbo frame?

19/11/2023
hotwire turbo frames modals

How to redirect from a form that is inside a turbo frame?

This is a very specific question that you will definitely have after working with Hotwire for some time.

There are many possible solutions, some better that the others.

Let's explore the problem and different strategies to solving it:

  1. add and click a hidden link
  2. new turbo stream redirect action
  3. adding turbo stream helpers and params

0:00 Introduction
0:49 Full page redirect does not work?
4:00 Break out of turbo frame does not work?
4:55 turbo stream hidden link
10:50 do not cache hidden link
12:42 Create a New Turbo Stream Action (best redirect)
14:56 A Turbo Stream action with params (more complicated)
19:50 Final demo

Episode source code: https://github.com/corsego/151-dialog-turbo-modals/commit/c2cecbae1da1e327f8ad91c403531a8ec738a3d1
Based on this blogpost: https://blog.corsego.com/custom-turbo-stream-actions

0
Sign in to join the conversation