Skip to content

Commit 6b99131

Browse files
committed
Improve merge_props performance
1 parent 6ea5879 commit 6b99131

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/inertia_rails/renderer.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def shared_data
6666
# Functionally, this permits using either string or symbol keys in the controller. Since the results
6767
# is cast to json, we should treat string/symbol keys as identical.
6868
def merge_props(shared_data, props)
69-
shared_data.deep_symbolize_keys.send(@deep_merge ? :deep_merge : :merge, props.deep_symbolize_keys)
69+
if @deep_merge
70+
shared_data.deep_symbolize_keys.deep_merge!(props.deep_symbolize_keys)
71+
else
72+
shared_data.symbolize_keys.merge(props.symbolize_keys)
73+
end
7074
end
7175

7276
def computed_props

0 commit comments

Comments
 (0)