Skip to content

Commit f0dcd35

Browse files
make sure inertia initialize shared data for renderer
1 parent 0158d32 commit f0dcd35

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/inertia_rails/controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ def default_render
6464
end
6565

6666
def shared_data
67-
return {} unless @_inertia_shared_plain_data
67+
# Theses variables are set in the before_action, but we need to ensure they are initialized when using renderer alone
68+
@_inertia_shared_plain_data ||= {}
69+
@_inertia_shared_blocks ||= []
70+
6871
@_inertia_shared_plain_data.merge(evaluated_blocks)
6972
end
7073

0 commit comments

Comments
 (0)