Refresh a frame programmatically

Lets imagine I have a page with 2 frames on it.

  • One to display a list of items
  • Other is a form to create that item

Post form submission, I want to trigger a refresh on the frame holding the list of items.

One option is to return a stream from the form submission response that appends to the list. But in that case I am hard wiring my form responses to be aware of a turbo app + the navigation style.

Instead, I want form submission to be its own thing. Submit form + redirect. Job done and then the frontend using stimulus to trigger a refresh on the list frame


I’d do this using a turbo_stream.erb file, it feels like the turbo_stream format are navigation aware. It’s kinda hard do reuse that same turbo_stream response for different navigation purposes

@virk @jonathanbruno
I created ‘hotwrie-scaffold’ .
This is SPA for scaffold with form in index view.


  • index.html.erb
<%= turbo_frame_tag 'post_form', src: new_post_path, target: 'post_form' %>
  • new.html.erb:
<%= turbo_frame_tag 'post_form' do %>
  <h2>New Post</h2>
  <%= render 'form', post: @post %>
<% end %>