class React::Element
Public Instance Methods
hide_while_loading()
click to toggle source
# File lib/reactive_record/active_record/reactive_record/while_loading.rb, line 233 def hide_while_loading while_loading end
while_loading(display = "", &loading_display_block)
click to toggle source
# File lib/reactive_record/active_record/reactive_record/while_loading.rb, line 204 def while_loading(display = "", &loading_display_block) loaded_children = [] loaded_children = block.call.dup if block if display.respond_to? :as_node display = display.as_node loading_display_block = lambda { display.render } elsif !loading_display_block loading_display_block = lambda { display } end loading_children = RenderingContext.build do |buffer| result = loading_display_block.call result = result.to_s if result.try :acts_as_string? result.span.tap { |e| e.waiting_on_resources = RenderingContext.waiting_on_resources } if result.is_a? String buffer.dup end new_element = React.create_element( ReactiveRecord::WhileLoading, loading: waiting_on_resources, loading_children: loading_children, loaded_children: loaded_children, element_type: [type], element_props: properties) RenderingContext.replace(self, new_element) end