Turbo_stream.update + redirect_to

Hi, I am new to turbo streams.

I have a view

<%= current_user.partners.size %>
new_partner_path, data: { turbo_frame: 'partner_frame' }

controller
def create
if @partner.save
respond_to do |format|
format.html { redirect_to profile_path(current_user), notice: t(‘form.update_success’) }
format.turbo_stream

<%= turbo_stream.update “counter”, current_user.partners.size %>

The value in the counter div is updated but the form not closed again.
If I comment out the #format.turbo_stream
The form closes but the counter size (of course) is not updated.

Why ?
Thanks for help

For some reason it works now. After checking DHH’s video about Turbo…
It needed the: <%= turbo_frame_tag “new_partner”, target: “_top” do %> to wrap the form.

view:

<%= current_user.partners.size %>

<%= link_to “New”, new_partner_path, data: { turbo_frame: ‘profile_frame’ }) %>

<%= turbo_frame_tag “new_partner”, target: “_top” do %>
<%= form_with(model: partner) do |form| %>

<%= render current_user.partners %>

_partner.hrml.erb

<%= partner.place %>

controller:
if @partner.save
respond_to do |format|
format.html { redirect_to profile_path(current_user), notice: t(‘form.update_success’) }
end
else
render :new
end

create.turbo_stream.erb

<%= turbo_stream.update “counter”, current_user.partners.size %>