File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 77require 'patches/mapper'
88
99ActionController ::Renderers . add :inertia do |component , options |
10+ if component . is_a? ( Hash ) && options [ :props ] . nil?
11+ options [ :props ] = component
12+ component = true
13+ end
14+
1015 InertiaRails ::Renderer . new (
1116 component ,
1217 self ,
Original file line number Diff line number Diff line change @@ -26,4 +26,8 @@ def provided_props_test
2626 def default_component_test
2727 render inertia : true
2828 end
29+
30+ def default_component_with_params_test
31+ render inertia : { my : 'props' }
32+ end
2933end
Original file line number Diff line number Diff line change 4343 get 'default_render_test' => 'inertia_rails_mimic#default_render_test'
4444 get 'transformed_default_render_test' => 'transformed_inertia_rails_mimic#render_test'
4545 get 'default_component_test' => 'inertia_rails_mimic#default_component_test'
46+ get 'default_component_with_params_test' => 'inertia_rails_mimic#default_component_with_params_test'
4647 get 'provided_props_test' => 'inertia_rails_mimic#provided_props_test'
4748
4849 post 'redirect_to_share_test' => 'inertia_test#redirect_to_share_test'
Original file line number Diff line number Diff line change 2424
2525 expect_inertia . to render_component ( 'inertia_rails_mimic/default_component_test' )
2626 end
27+
28+ it 'has the correct derived component with props' do
29+ get default_component_with_params_test_path
30+
31+ expect_inertia . to render_component ( 'inertia_rails_mimic/default_component_with_params_test' )
32+ . and have_exact_props ( { my : 'props' } )
33+ end
2734 end
2835
2936 context 'no render is done at all and default_render is enabled' do
You can’t perform that action at this time.
0 commit comments