Rails 7, Devise in turbo_frames
- Rails 7.0.6
- Devise 4.9
Summary
I have a pretty standard Devise setup with links in a global navbar that look like this.
<%= link_to('Create account', new_user_registration_path, data: {turbo_frame: 'auth-modal'} ) %>
<%= link_to('Sign in', new_user_session_path, data: {turbo_frame: 'auth-modal'} ) %>
In my application.html.erb, I have a turbo_frame_tag
<%= turbo_frame_tag('auth-modal') %>
My Devise templates have the correct corresponding tags
<%= turbo_frame_tag('auth-modal') do %> Devise new session form / Devise new registration form <% end %>
I also have the necessary css in place to make the frame look an actual modal when displayed.
When clicking the links in the navbar the Sign in/log in templates do show as expected, styled as a modal. And I can sign up and login as expected.
The issue
The majority of my pages show certain content for logged out users and user specific content for logged in users. I'm trying to figure out how to update the current page, after a successful login or registration to show the new user specific content instead of the generic content. If I manually refresh the page everything works as expected. Obviously that's not ideal to make user refresh the page after logging in.
Thanks for any help in advance, and please let me know if anything is unclear!