Skip to content

Commit

Permalink
Render full documents for requests with Turbo-Frame: header
Browse files Browse the repository at this point in the history
Re-submission of [#232][]
Related to [hotwired/turbo#1047][]

Render full documents, including default layout rendering behavior.

Rendering a minimal layout forces `turbo:reload` events because of the
severe difference in the contents of the minimal layout's `<head>` and
the requesting document's fully populated `<head>`.

[#232]: #232
[hotwired/turbo#1047]: hotwired/turbo#1047
  • Loading branch information
seanpdoyle committed Dec 1, 2023
1 parent 4eb4e92 commit a48e0f5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion app/controllers/turbo/frames/frame_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module Turbo::Frames::FrameRequest
extend ActiveSupport::Concern

included do
layout -> { "turbo_rails/frame" if turbo_frame_request? }
etag { :frame if turbo_frame_request? }

helper_method :turbo_frame_request_id
Expand Down
8 changes: 0 additions & 8 deletions app/views/layouts/turbo_rails/frame.html.erb

This file was deleted.

4 changes: 2 additions & 2 deletions test/frames/frame_request_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Turbo::FrameRequestControllerTest < ActionDispatch::IntegrationTest
assert_select "title", count: 1

get tray_path(id: 1), headers: { "Turbo-Frame" => "true" }
assert_select "title", count: 0
assert_select "title", count: 1
end

test "frame request layout includes `head` content" do
Expand All @@ -22,7 +22,7 @@ class Turbo::FrameRequestControllerTest < ActionDispatch::IntegrationTest
end

assert_select "meta[name=test][content=present]"
assert_select "meta[name=alternative][content=present]"
assert_select "meta[name=alternative][content=present]", count: 0
end

test "frame requests get a unique etag" do
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ hasown@^2.0.0:
dependencies:
function-bind "^1.1.2"

"idiomorph@git+https://github.com/basecamp/idiomorph.git#rollout-build":
"idiomorph@https://github.com/basecamp/idiomorph#rollout-build":
version "0.0.8"
resolved "git+https://github.com/basecamp/idiomorph.git#e906820368e4c9c52489a3336b8c3826b1bf6de5"
resolved "https://github.com/basecamp/idiomorph#e906820368e4c9c52489a3336b8c3826b1bf6de5"

is-core-module@^2.13.0:
version "2.13.1"
Expand Down

0 comments on commit a48e0f5

Please sign in to comment.