Rails Turbo Stream with Stimulus

Hello,

I’ve been stuck for a while and it’s becoming irritating…

I’m having trouble rendering the turbo_stream action (replace and update) in this example. Everything renders OK, however my Stimulus controller becomes disconnected even when it is outside of the turbo_frame that I’m rendering in. What is going on?!?! I can’t get it to reconnect, even manually. I truly need help, and yes, I am new to Hotwire.

My code:

in my RegistrationsController#create action I got
turbo_stream.update(“registry”, partial: “devise/registrations/new”, locals: { resource: resource })
which renders fine in my page sessions/new

<%= turbo_frame_tag ‘registry’ do %>
<%= render “devise/registrations/new” %>
<% end %>

The problem is that when I click submit form inside registrations/_new partial it disconnects me from Stimulus!

My expected result would be: turbo_stream.update(“registry”, partial: “devise/registrations/new”, locals: { resource: resource }) successfully re renders the turbo_frame_tag “registry” while I’m still connected to the Stimulus controller.

P.S: There aren’t any typos or code errors… This has to be something with Turbo Stream + Stimulus thing that I’m missing.

Any help would be appreciated.

Thanks in advance!

Can you share more code? The before/after HTML and the stimulus controller?