Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 1f77b98

Browse files
committed
No need to reinvent Hash equality
1 parent 1b8a176 commit 1f77b98

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/react/component.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,13 @@ def component_will_receive_props(next_props)
122122
self.class.process_exception(e, self)
123123
end
124124

125-
def props_changed?(next_props)
126-
return true unless props.keys.sort == next_props.keys.sort
127-
props.detect { |k, v| `#{next_props[k]} != #{params[k]}`}
128-
end
129-
130125
def should_component_update?(next_props, next_state)
131126
State.set_state_context_to(self) do
132127
if self.respond_to?(:needs_update?)
133128
!!self.needs_update?(next_props, next_state)
134129
elsif false # switch to true to force updates per standard react
135130
true
136-
elsif props_changed? next_props
131+
elsif props != next_props
137132
true
138133
elsif `!next_state != !#{@native}.state`
139134
true

0 commit comments

Comments
 (0)