-
-
Save blrB/1b0e1d44f31df1d1c9932985471ec3b3 to your computer and use it in GitHub Desktop.
Turbo eager-loaded frame issue (ruby 3.1.0, rails 7.0.1, turbo-rails (1.0.1))
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
def page | |
end | |
def page_redirect | |
redirect_to page_path, status: :moved_permanently | |
end | |
def page_post_redirect | |
redirect_to page_path, status: :moved_permanently | |
end | |
def src_content | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- /app/views/application/page.html.erb --> | |
<div id="demo-page"> | |
<p>page body start:</p> | |
<p><%= Time.now.strftime('%H:%M:%S') %> | |
</p> | |
<%= link_to 'GET redirect', page_redirect_path %> | |
<%= link_to 'POST redirect', page_post_redirect_path, data: { turbo_method: :post } %> | |
<div style="border: solid;"> | |
<%= turbo_frame_tag id="src_content", src: src_content_path do %> | |
Loading... | |
<% end %> | |
</div> | |
<p>page body end.</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /config/routes.rb | |
Rails.application.routes.draw do | |
get :page, controller: :application | |
get :page_redirect, controller: :application | |
post :page_post_redirect, controller: :application | |
get :src_content, controller: :application | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- /app/views/application/src_content.html.erb --> | |
<%= turbo_frame_tag :src_content do %> | |
<p>turbo-frame body start:</p> | |
<p><%= Time.now.strftime('%H:%M:%S') %> | |
</p> | |
<p>turbo-frame body end.</p> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment