lib/hyperloop/d3/mixin.rb in hyper-d3-1.0.0.lap25 vs lib/hyperloop/d3/mixin.rb in hyper-d3-1.0.0.lap26

- old
+ new

@@ -18,10 +18,16 @@ else raise "No DOM Node available for D3::Selection" end end + def redraw + if @_dom_node && @_d3_render_block + @_d3_render_block.call(selection, @_data) + end + end + def self.before_unmount_with_selection(&block) before_unmount do if @_dom_node && block block.call(selection, @_data) end @@ -43,20 +49,16 @@ def should_component_update? false end after_mount do - if @_dom_node && @_d3_render_block - @_d3_render_block.call(selection, @_data) - end + redraw end before_receive_props do |new_props| if new_props[:data] != @_data @_data = new_props[:data] - if @_dom_node && @_d3_render_block - @_d3_render_block.call(selection, @_data) - end + redraw end end end end \ No newline at end of file