Using turbo stream and turbo frame with GET requests (solved)

So, im having a hard time wrapping my head around this issue. It just cant get solved.

So, basically i have this

what i want is that when i click on the left side. I issue a request to the server and render turbo_stream response to change the chats of that conversation.

Currently my controller looks like this

class ConversationsController < ApplicationController
  def show
    respond_to do |format|
      format.html {

    render layout: false, format: "text/vnd.turbo-stream.html"

and i have two partials, show.html.erb and show.trubo_stream.erb

This is the show.turbo_stream.erb file content

<%= turbo_stream.replace "conversation-inbox", class: "w-full flex" do %>
  <main class="w-8/12 rounded-xl mx-2 flex flex-col relative bg-secondary px-6 py-5">

<% end %>

 to replace the conversation that was pressed
<%= turbo_stream.replace @conversation do %>
  <%= turbo_frame_tag @conversation do %>
  <% end %>
<% end %>

and it just keeps giving me this error

Response has no matching <turbo-frame id="conversation_18"> element

this is what a single conversation partial looks like

  <%= turbo_frame_tag dom_id(conversation) do %>

    <%= button_to business_conversation_path(business_id: @business, id: conversation, params: { filter: params[:filter] }),
                 class: "outline-none focus:outline-none flex items-center justify-between my-1 p-2 rounded-lg #{decorator.active_class }",
                  id: dom_id(conversation), form: {data: {turbo_frame: "conversation-inbox"}}, method: :get do %>
... content

    <% end %>
  <% end %>

Any idea why this occurs? i have scratched my head on this one and looked at all related issues on this forum and GitHub.

I found it explained here. Hope it helps Document Turbo Stream Accept: header changes by seanpdoyle · Pull Request #40 · hotwired/turbo-site · GitHub

1 Like