I have a nested turbo frame
My controller is something like
def landing_page
@variable = params[:variable].present? ? params[:variable] : "hello"
end
The view for my landing page is:
<%= turbo_frame_tag "outer" do %>
<div><%= @variable %></div>
<%= turbo_frame_tag "inner" do %>
<div><%= @variable %></div>
<%= link_to "link to same landing page", landing_page_path(variable: "World") %>
<% end %>
<% end %>
On initial page render:
- there is no
params[:variable]
, so the value of @variable is "hello" - on the page itself, both variables successfully output the text of "hello"
When I click on the link:
params[:variable]
exists, therefore the value of @variable on the incoming turbo frame is "world"- It modifies variable in the "inner" turbo_frame, but does not modify the variable in the "outer" turbo_frame.
This is actually the functionality I want (I am successfully able to modify the inner frame, but not the outer one). However, when looking at the network tab, this appears to be making a full HTML page request, even though it's only modifying the inner frame.
I would expect the network request to be something like:
<turbo-frame id="inner">
<div>World</div>
<a href="/rooms?variable=World">link to same landing page</a>
</turbo-frame>
instead, the network tab is showing that I'm receiving the entire html of
<html>
<head>
</head>
<body>
<turbo-frame id="outer">
<div>World</div>
<turbo-frame id="inner">
<div>World</div>
<a href="/rooms?variable=World">link to same landing page</a>
</turbo-frame>
</turbo-frame>
</body>
</html>
The examples I've seen in the rails tutorial always seem to be predicated on the idea of going from one page to another page. Unfortunately, in my exact use case, I'm using a multistep form gem called wicked wizard and it doesn't seem like I can use turbostreams for this, and moving the inner frame outside of the outer frame isn't an option