Skip to content

Turbo layout not rendered for turbo streams #730

Open
@anhari

Description

@anhari

Probably a PEBKAC situation, when trying to carry flash messages by default in turbo stream responses, I created the following

<!-- app/views/layouts/turbo_rails/frame.html.erb (also tried frame.turbo_stream.erb) -->
<html>
  <head>
    <%= csrf_meta_tags %>
    <%= yield :head %>
  </head>
  <body>
    <%= turbo_stream.replace "flash-messages" do %>
      <%= flash__toast %>
    <% end %>
    <%= yield %>
  </body>
</html>

but my turbo stream responses do not include a layout. When trying to debug, the following in a turbo stream response (i.e. update.turbo_stream.erb), seems like it should point to those files but doesn't:

<%= raise(controller.send :_layout, lookup_context, []) %>
<!-- #> "turbo_rails/frame" -->

I tried reading through #351, but still couldn't quite figure things out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions