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

Commit 483a334

Browse files
committed
fixed #126
1 parent 6c942d6 commit 483a334

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

lib/react/component/props_wrapper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def self.define_param(name, param_type, owner)
5454
def unchanged_processed_params(new_props)
5555
Hash[
5656
*@processed_params.collect do |key, value|
57-
[key, value] if @props[key] == new_props[key]
57+
[key, value] if @props[key].equal? new_props[key] # `#{@props[key]} == #{new_props[key]}`
5858
end.compact.flatten(1)
5959
]
6060
end

lib/reactive-ruby/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module React
2-
VERSION = "0.7.40"
2+
VERSION = "0.7.41"
33
end

spec/react/param_declaration_spec.rb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,31 +218,37 @@ def render
218218
expect(React.render_to_static_markup(React.create_element(Foo, foo: {bazwoggle: 1}))).to eq('<span>2</span>')
219219
end
220220

221-
it "not after state update" do
221+
it "even if contains an embedded native object" do
222+
stub_const "Bar", Class.new(React::Component::Base)
222223
stub_const "BazWoggle", Class.new
223224
BazWoggle.class_eval do
224225
def initialize(kind)
225226
@kind = kind
226227
end
227228
attr_accessor :kind
228229
def self._react_param_conversion(json, validate_only)
229-
new(json[:bazwoggle]) if json[:bazwoggle]
230+
new(JSON.from_object(json[0])[:bazwoggle]) if JSON.from_object(json[0])[:bazwoggle]
230231
end
231-
end
232-
Foo.class_eval do
232+
end
233+
Bar.class_eval do
233234
param :foo, type: BazWoggle
235+
def render
236+
params.foo.kind.to_s
237+
end
238+
end
239+
Foo.class_eval do
234240
export_state :change_me
235241
before_mount do
236-
params.foo.kind = params.foo.kind+1
242+
Foo.change_me! "initial"
237243
end
238244
def render
239-
"#{params.foo.kind} - #{Foo.change_me}"
245+
Bar(foo: Native([`{bazwoggle: #{Foo.change_me}}`]))
240246
end
241247
end
242248
div = `document.createElement("div")`
243-
React.render(React.create_element(Foo, foo: {bazwoggle: 1}), div)
249+
React.render(React.create_element(Foo, {}), div)
244250
Foo.change_me! "updated"
245-
expect(`div.children[0].innerHTML`).to eq("2 - updated")
251+
expect(`div.children[0].innerHTML`).to eq("updated")
246252
end
247253
end
248254

0 commit comments

Comments
 (0)