Skip to content

Commit 9bbf451

Browse files
refactor inertia html headers setter
1 parent f0dcd35 commit 9bbf451

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/inertia_rails/controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ def inertia_headers
5555
@_inertia_html_headers.join.html_safe
5656
end
5757

58+
def inertia_headers=(value)
59+
@_inertia_html_headers = value
60+
end
61+
5862
def default_render
5963
if InertiaRails.default_render?
6064
render(inertia: true)

lib/inertia_rails/renderer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def render_ssr
3232
uri = URI("#{::InertiaRails.ssr_url}/render")
3333
res = JSON.parse(Net::HTTP.post(uri, page.to_json, 'Content-Type' => 'application/json').body)
3434

35-
@controller.instance_variable_set("@_inertia_html_headers", res['head'])
35+
@controller.inertia_headers = res['head']
3636
@render_method.call html: res['body'].html_safe, layout: layout, locals: (view_data).merge({page: page})
3737
end
3838

0 commit comments

Comments
 (0)