hyper-model 0.99.6 → 1.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
@@ -180,10 +180,10 @@ module ReactiveRecord
180
180
 
181
181
  def changed?(*args)
182
182
  if args.count == 0
183
- React::State.get_state(self, "!CHANGED!")
183
+ Hyperstack::Internal::Store::State.get_state(self, "!CHANGED!")
184
184
  !changed_attributes.empty?
185
185
  else
186
- React::State.get_state(self, args[0])
186
+ Hyperstack::Internal::Store::State.get_state(self, args[0])
187
187
  changed_attributes.include? args[0]
188
188
  end
189
189
  end
@@ -288,7 +288,7 @@ module ReactiveRecord
288
288
  end
289
289
 
290
290
  def saving!
291
- React::State.set_state(self, self, :saving) unless data_loading?
291
+ Hyperstack::Internal::Store::State.set_state(self, self, :saving) unless data_loading?
292
292
  @saving = true
293
293
  end
294
294
 
@@ -306,9 +306,9 @@ module ReactiveRecord
306
306
  notify_waiting_for_save
307
307
  return self if save_only
308
308
  if errors.empty?
309
- React::State.set_state(self, self, :saved)
309
+ Hyperstack::Internal::Store::State.set_state(self, self, :saved)
310
310
  elsif !data_loading?
311
- React::State.set_state(self, self, :error)
311
+ Hyperstack::Internal::Store::State.set_state(self, self, :error)
312
312
  end
313
313
  self
314
314
  end
@@ -334,7 +334,7 @@ module ReactiveRecord
334
334
  end
335
335
 
336
336
  def saving?
337
- React::State.get_state(self, self)
337
+ Hyperstack::Internal::Store::State.get_state(self, self)
338
338
  @saving
339
339
  end
340
340
 
@@ -387,7 +387,7 @@ module ReactiveRecord
387
387
  @catch_db_requests = true
388
388
  yield
389
389
  rescue DbRequestMade => e
390
- React::IsomorphicHelpers.log "Warning: request for server side data during scope evaluation: #{e.message}", :warning
390
+ Hyperstack::Component::IsomorphicHelpers.log "Warning: request for server side data during scope evaluation: #{e.message}", :warning
391
391
  return_val
392
392
  ensure
393
393
  @catch_db_requests = false
@@ -132,7 +132,7 @@ To determine this sync_scopes first asks if the record being changed is in the s
132
132
  # the broadcast record and the value on the client is out of sync
133
133
  # not running set_pre_sync_related_records will cause sync scopes
134
134
  # to refresh all related scopes
135
- React::State.bulk_update do
135
+ Hyperstack::Internal::State::Mapper.bulk_update do
136
136
  record = broadcast.record_with_current_values
137
137
  apply_to_all_collections(
138
138
  :set_pre_sync_related_records,
@@ -292,7 +292,7 @@ To determine this sync_scopes first asks if the record being changed is in the s
292
292
  # end of stuff to move
293
293
 
294
294
  def reload_from_db(force = nil)
295
- if force || React::State.has_observers?(self, :collection)
295
+ if force || Hyperstack::Internal::Store::State.observed?(self, :collection)
296
296
  @out_of_date = false
297
297
  ReactiveRecord::Base.load_from_db(nil, *@vector, '*all') if @collection
298
298
  ReactiveRecord::Base.load_from_db(nil, *@vector, '*count')
@@ -308,15 +308,15 @@ To determine this sync_scopes first asks if the record being changed is in the s
308
308
  @observing = true
309
309
  link_to_parent
310
310
  reload_from_db(true) if @out_of_date
311
- React::State.get_state(self, :collection)
311
+ Hyperstack::Internal::Store::State.get_state(self, :collection)
312
312
  ensure
313
313
  @observing = false
314
314
  end
315
315
  end
316
316
 
317
317
  def set_count_state(val)
318
- unless ReactiveRecord::WhileLoading.has_observers?
319
- React::State.set_state(self, :collection, collection, true)
318
+ unless ReactiveRecord::WhileLoading.observed?
319
+ Hyperstack::Internal::Store::State.set_state(self, :collection, collection, true)
320
320
  end
321
321
  @count = val
322
322
  end
@@ -549,7 +549,7 @@ To determine this sync_scopes first asks if the record being changed is in the s
549
549
  end
550
550
 
551
551
  def notify_of_change(value = nil)
552
- React::State.set_state(self, "collection", collection) unless ReactiveRecord::Base.data_loading?
552
+ Hyperstack::Internal::Store::State.set_state(self, "collection", collection) unless ReactiveRecord::Base.data_loading?
553
553
  value
554
554
  end
555
555
 
@@ -99,7 +99,7 @@ module ReactiveRecord
99
99
  else
100
100
  virtual_fetch_on_server_warning(attribute) if on_opal_server? && changed?
101
101
  yield false, attribute
102
- end.tap { |value| React::State.get_state(self, attribute) unless data_loading? }
102
+ end.tap { |value| Hyperstack::Internal::Store::State.get_state(self, attribute) unless data_loading? }
103
103
  end
104
104
 
105
105
  def find_association(association, id)
@@ -4,7 +4,7 @@ module ReactiveRecord
4
4
 
5
5
  class Base
6
6
 
7
- include React::IsomorphicHelpers
7
+ include Hyperstack::Component::IsomorphicHelpers
8
8
 
9
9
  before_first_mount do |context|
10
10
  if RUBY_ENGINE != 'opal'
@@ -132,7 +132,7 @@ module ReactiveRecord
132
132
  end
133
133
 
134
134
  def self.schedule_fetch
135
- React::State.set_state(WhileLoading, :quiet, false) # moved from while loading module see loading! method
135
+ Hyperstack::Internal::Store::State.set_state(WhileLoading, :quiet, false) # moved from while loading module see loading! method
136
136
  return if @fetch_scheduled
137
137
  @current_fetch_id = Time.now
138
138
  @fetch_scheduled = after(0) do
@@ -242,7 +242,7 @@ module ReactiveRecord
242
242
  end if record.new? || record.changed? || (record == record_being_saved && force)
243
243
  record_index += 1
244
244
  end
245
- [models.sort_by { |model| model[:id] }, associations, backing_records]
245
+ [models, associations, backing_records]
246
246
  end
247
247
 
248
248
  def save_or_validate(save, validate, force, &block)
@@ -308,7 +308,6 @@ module ReactiveRecord
308
308
  backing_records.each { |_id, record| record.saved!(true) rescue nil } if save
309
309
  end
310
310
  rescue Exception => e
311
- debugger
312
311
  log("Exception raised while saving - #{e}", :error)
313
312
  yield false, e.message, [] if block
314
313
  promise.resolve({success: false, message: e.message, models: []})
@@ -481,7 +480,7 @@ module ReactiveRecord
481
480
  saved_models = reactive_records.collect do |reactive_record_id, model|
482
481
  messages = model.errors.messages if validate && !model.valid?
483
482
  all_messages << [model, messages] if save && messages
484
- attributes = model.__hyperloop_secure_attributes(acting_user)
483
+ attributes = model.__hyperstack_secure_attributes(acting_user)
485
484
  [reactive_record_id, model.class.name, attributes, messages]
486
485
  end
487
486
 
@@ -7,7 +7,7 @@ module ReactiveRecord
7
7
 
8
8
  module Operations
9
9
  # to make debug easier we convert all the object_id strings to be hex representation
10
- class Base < Hyperloop::ControllerOp
10
+ class Base < Hyperstack::ControllerOp
11
11
  param :acting_user, nils: true
12
12
 
13
13
  FORMAT = '0x%x'
@@ -66,7 +66,7 @@ module ReactiveRecord
66
66
  end
67
67
  failed do |e|
68
68
  # AccessViolations are already sent to on_error
69
- Hyperloop.on_error(e, :fetch_error, params.to_h) unless e.is_a? Hyperloop::AccessViolation
69
+ Hyperstack.on_error(e, :fetch_error, params.to_h) unless e.is_a? Hyperstack::AccessViolation
70
70
  raise e
71
71
  end
72
72
  end
@@ -92,7 +92,7 @@ module ReactiveRecord
92
92
  @attributes[attr] = new_value
93
93
  if !data_loading? ||
94
94
  (on_opal_client? && had_key && current_value.loaded? && current_value != new_value)
95
- React::State.set_state(self, attr, new_value, data_loading?)
95
+ Hyperstack::Internal::Store::State.set_state(self, attr, new_value, data_loading?)
96
96
  end
97
97
  end
98
98
  end
@@ -101,7 +101,7 @@ module ReactiveRecord
101
101
  def set_change_status_and_notify_only(attr, changed)
102
102
  return if @virgin
103
103
  change_status_and_notify_helper(attr, changed) do
104
- React::State.set_state(self, attr, nil) unless data_loading?
104
+ Hyperstack::Internal::Store::State.set_state(self, attr, nil) unless data_loading?
105
105
  end
106
106
  end
107
107
 
@@ -117,7 +117,7 @@ module ReactiveRecord
117
117
  yield @attributes.key?(attr), @attributes[attr]
118
118
  return unless empty_before != changed_attributes.empty?
119
119
  if on_opal_client? && !data_loading?
120
- React::State.set_state(self, '!CHANGED!', !changed_attributes.empty?, true)
120
+ Hyperstack::Internal::Store::State.set_state(self, '!CHANGED!', !changed_attributes.empty?, true)
121
121
  end
122
122
  return unless aggregate_owner
123
123
  aggregate_owner.set_change_status_and_notify_only(
@@ -135,7 +135,7 @@ module ReactiveRecord
135
135
  return if value.nil?
136
136
  value.attributes[inverse_attr] = @ar_instance
137
137
  return if data_loading?
138
- React::State.set_state(value.backing_record, inverse_attr, @ar_instance)
138
+ Hyperstack::Internal::Store::State.set_state(value.backing_record, inverse_attr, @ar_instance)
139
139
  end
140
140
 
141
141
  def update_inverse_collections(association, value)
@@ -24,7 +24,7 @@ module ReactiveRecord
24
24
  @loads_pending = @load_stack.pop
25
25
  promise
26
26
  rescue Exception => e
27
- React::IsomorphicHelpers.log "ReactiveRecord.load exception raised during initial load: #{e}", :error
27
+ Hyperstack::Component::IsomorphicHelpers.log "ReactiveRecord.load exception raised during initial load: #{e}", :error
28
28
  end
29
29
 
30
30
  def self.loads_pending!
@@ -62,7 +62,7 @@ module ReactiveRecord
62
62
  end
63
63
  end
64
64
  rescue Exception => e
65
- React::IsomorphicHelpers.log "ReactiveRecord.load exception raised during retry: #{e}", :error
65
+ Hyperstack::Component::IsomorphicHelpers.log "ReactiveRecord.load exception raised during retry: #{e}", :error
66
66
  end
67
67
 
68
68
 
@@ -76,7 +76,7 @@ module ReactiveRecord
76
76
 
77
77
  class WhileLoading
78
78
 
79
- include React::IsomorphicHelpers
79
+ include Hyperstack::Component::IsomorphicHelpers
80
80
 
81
81
  before_first_mount do
82
82
  @css_to_preload = ""
@@ -92,7 +92,11 @@ module ReactiveRecord
92
92
  end
93
93
 
94
94
  def self.has_observers?
95
- React::State.has_observers?(self, :loaded_at)
95
+ Hyperstack::Internal::Store::State.observed?(self, :loaded_at)
96
+ end
97
+
98
+ class << self
99
+ alias :observed? :has_observers?
96
100
  end
97
101
 
98
102
  prerender_footer do
@@ -105,7 +109,7 @@ module ReactiveRecord
105
109
  # -: You think wrong. add_style_sheet uses the jQuery $, after_mount too, others too
106
110
  # -: I removed those references. Now you think right.
107
111
 
108
- include Hyperloop::Component::Mixin
112
+ include Hyperstack::Component
109
113
 
110
114
  param :loading
111
115
  param :loaded_children
@@ -121,29 +125,29 @@ module ReactiveRecord
121
125
  end
122
126
 
123
127
  def loading!
124
- React::RenderingContext.waiting_on_resources = true
125
- React::State.get_state(self, :loaded_at)
128
+ Hyperstack::Internal::Component::RenderingContext.waiting_on_resources = true
129
+ Hyperstack::Internal::Store::State.get_state(self, :loaded_at)
126
130
  # this was moved to where the fetch is actually pushed on to the fetch array in isomorphic base
127
- # React::State.set_state(self, :quiet, false)
131
+ # Hyperstack::Internal::Store::State.set_state(self, :quiet, false)
128
132
  @is_loading = true
129
133
  end
130
134
 
131
135
  def loaded_at(loaded_at)
132
- React::State.set_state(self, :loaded_at, loaded_at)
136
+ Hyperstack::Internal::Store::State.set_state(self, :loaded_at, loaded_at)
133
137
  @is_loading = false
134
138
  end
135
139
 
136
140
  def quiet?
137
- React::State.get_state(self, :quiet)
141
+ Hyperstack::Internal::Store::State.get_state(self, :quiet)
138
142
  end
139
143
 
140
144
  def page_loaded?
141
- React::State.get_state(self, :page_loaded)
145
+ Hyperstack::Internal::Store::State.get_state(self, :page_loaded)
142
146
  end
143
147
 
144
148
  def quiet!
145
- React::State.set_state(self, :quiet, true)
146
- after(1) { React::State.set_state(self, :page_loaded, true) } unless on_opal_server? or @page_loaded
149
+ Hyperstack::Internal::Store::State.set_state(self, :quiet, true)
150
+ after(1) { Hyperstack::Internal::Store::State.set_state(self, :page_loaded, true) } unless on_opal_server? or @page_loaded
147
151
  @page_loaded = true
148
152
  end
149
153
 
@@ -166,18 +170,18 @@ module ReactiveRecord
166
170
  before_mount do
167
171
  @uniq_id = WhileLoading.get_next_while_loading_counter
168
172
  WhileLoading.preload_css(
169
- ".reactive_record_while_loading_container_#{@uniq_id} > :nth-child(1n+#{params.loaded_children.count+1}) {\n"+
173
+ ".reactive_record_while_loading_container_#{@uniq_id} > :nth-child(1n+#{@LoadedChildren.count+1}) {\n"+
170
174
  " display: none;\n"+
171
175
  "}\n"
172
176
  )
173
177
  end
174
178
 
175
179
  after_mount do
176
- @waiting_on_resources = params.loading
180
+ @waiting_on_resources = @Loading
177
181
  WhileLoading.add_style_sheet
178
182
  node = dom_node
179
183
  %x{
180
- var nodes = node.querySelectorAll(':nth-child(-1n+'+#{params.loaded_children.count}+')');
184
+ var nodes = node.querySelectorAll(':nth-child(-1n+'+#{@LoadedChildren.count}+')');
181
185
  nodes.forEach(
182
186
  function(current_node, current_index, list_obj) {
183
187
  if (current_node.className.indexOf('reactive_record_show_when_loaded') === -1) {
@@ -185,7 +189,7 @@ module ReactiveRecord
185
189
  }
186
190
  }
187
191
  );
188
- nodes = node.querySelectorAll(':nth-child(1n+'+#{params.loaded_children.count+1}+')');
192
+ nodes = node.querySelectorAll(':nth-child(1n+'+#{@LoadedChildren.count+1}+')');
189
193
  nodes.forEach(
190
194
  function(current_node, current_index, list_obj) {
191
195
  if (current_node.className.indexOf('reactive_record_show_while_loading') === -1) {
@@ -197,20 +201,20 @@ module ReactiveRecord
197
201
  end
198
202
 
199
203
  after_update do
200
- @waiting_on_resources = params.loading
204
+ @waiting_on_resources = @Loading
201
205
  end
202
206
 
203
207
  def render
204
- props = params.element_props.dup
208
+ props = @ElementProps.dup
205
209
  classes = [props[:class], props[:className], "reactive_record_while_loading_container_#{@uniq_id}"].compact.join(" ")
206
210
  props.merge!({
207
211
  "data-reactive_record_while_loading_container_id" => @uniq_id,
208
212
  "data-reactive_record_enclosing_while_loading_container_id" => @uniq_id,
209
213
  class: classes
210
214
  })
211
- React.create_element(params.element_type[0], props) do
212
- params.loaded_children + params.loading_children
213
- end.tap { |e| e.waiting_on_resources = params.loading }
215
+ ReactAPI.create_element(@ElementType[0], props) do
216
+ @LoadedChildren + @LoadingChildren
217
+ end.tap { |e| e.waiting_on_resources = @Loading }
214
218
  end
215
219
 
216
220
  end
@@ -219,124 +223,124 @@ module ReactiveRecord
219
223
 
220
224
  end
221
225
 
222
- module React
226
+ module Hyperstack
227
+ module Component
223
228
 
224
- class Element
229
+ class Element
225
230
 
226
- def while_loading(display = "", &loading_display_block)
227
- loaded_children = []
228
- loaded_children = block.call.dup if block
229
- if display.respond_to? :as_node
230
- display = display.as_node
231
- loading_display_block = lambda { display.render }
232
- elsif !loading_display_block
233
- loading_display_block = lambda { display }
234
- end
235
- loading_children = RenderingContext.build do |buffer|
236
- result = loading_display_block.call
237
- result = result.to_s if result.try :acts_as_string?
238
- result.span.tap { |e| e.waiting_on_resources = RenderingContext.waiting_on_resources } if result.is_a? String
239
- buffer.dup
240
- end
231
+ def while_loading(display = "", &loading_display_block)
232
+ loaded_children = []
233
+ loaded_children = block.call.dup if block
234
+ if display.respond_to? :as_node
235
+ display = display.as_node
236
+ loading_display_block = lambda { display.render }
237
+ elsif !loading_display_block
238
+ loading_display_block = lambda { display }
239
+ end
240
+ loading_children = Internal::Component::RenderingContext.build do |buffer|
241
+ result = loading_display_block.call
242
+ result = result.to_s if result.try :acts_as_string?
243
+ result.span.tap { |e| e.waiting_on_resources = Internal::Component::RenderingContext.waiting_on_resources } if result.is_a? String
244
+ buffer.dup
245
+ end
241
246
 
242
- new_element = React.create_element(
243
- ReactiveRecord::WhileLoading,
244
- loading: waiting_on_resources,
245
- loading_children: loading_children,
246
- loaded_children: loaded_children,
247
- element_type: [type],
248
- element_props: properties)
247
+ new_element = ReactAPI.create_element(
248
+ ReactiveRecord::WhileLoading,
249
+ loading: waiting_on_resources,
250
+ loading_children: loading_children,
251
+ loaded_children: loaded_children,
252
+ element_type: [type],
253
+ element_props: properties)
249
254
 
250
- RenderingContext.replace(self, new_element)
251
- end
255
+ Internal::Component::RenderingContext.replace(self, new_element)
256
+ end
252
257
 
253
- def hide_while_loading
254
- while_loading
255
- end
258
+ def hide_while_loading
259
+ while_loading
260
+ end
256
261
 
262
+ end
257
263
  end
258
264
  end
259
265
 
260
266
  if RUBY_ENGINE == 'opal'
261
- module Hyperloop
262
- class Component
263
- module Mixin
267
+ module Hyperstack
268
+ module Component
264
269
 
265
- alias_method :original_component_did_mount, :component_did_mount
270
+ alias_method :original_component_did_mount, :component_did_mount
266
271
 
267
- def component_did_mount(*args)
268
- original_component_did_mount(*args)
269
- reactive_record_link_to_enclosing_while_loading_container
270
- reactive_record_link_set_while_loading_container_class
271
- end
272
+ def component_did_mount(*args)
273
+ original_component_did_mount(*args)
274
+ reactive_record_link_to_enclosing_while_loading_container
275
+ reactive_record_link_set_while_loading_container_class
276
+ end
272
277
 
273
- alias_method :original_component_did_update, :component_did_update
278
+ alias_method :original_component_did_update, :component_did_update
274
279
 
275
- def component_did_update(*args)
276
- original_component_did_update(*args)
277
- reactive_record_link_set_while_loading_container_class
278
- end
280
+ def component_did_update(*args)
281
+ original_component_did_update(*args)
282
+ reactive_record_link_set_while_loading_container_class
283
+ end
279
284
 
280
- def reactive_record_link_to_enclosing_while_loading_container
281
- # Call after any component mounts - attaches the containers loading id to this component
282
- # Fyi, the while_loading container is responsible for setting its own link to itself
283
- node = dom_node
284
- %x{
285
- if (typeof node === "undefined" || node === null) return;
286
- var node_wl_attr = node.getAttribute('data-reactive_record_enclosing_while_loading_container_id');
287
- if (node_wl_attr === null || node_wl_attr === "") {
288
- var while_loading_container = node.closest('[data-reactive_record_while_loading_container_id]');
289
- if (while_loading_container !== null) {
290
- var container_id = while_loading_container.getAttribute('data-reactive_record_while_loading_container_id');
291
- node.setAttribute('data-reactive_record_enclosing_while_loading_container_id', container_id);
292
- }
285
+ def reactive_record_link_to_enclosing_while_loading_container
286
+ # Call after any component mounts - attaches the containers loading id to this component
287
+ # Fyi, the while_loading container is responsible for setting its own link to itself
288
+ node = dom_node
289
+ %x{
290
+ if (typeof node === "undefined" || node === null) return;
291
+ var node_wl_attr = node.getAttribute('data-reactive_record_enclosing_while_loading_container_id');
292
+ if (node_wl_attr === null || node_wl_attr === "") {
293
+ var while_loading_container = node.closest('[data-reactive_record_while_loading_container_id]');
294
+ if (while_loading_container !== null) {
295
+ var container_id = while_loading_container.getAttribute('data-reactive_record_while_loading_container_id');
296
+ node.setAttribute('data-reactive_record_enclosing_while_loading_container_id', container_id);
293
297
  }
294
298
  }
295
- end
299
+ }
300
+ end
296
301
 
297
- def reactive_record_link_set_while_loading_container_class
298
- node = dom_node
299
- loading = (waiting_on_resources ? `true` : `false`)
300
- %x{
301
- if (typeof node === "undefined" || node === null) return;
302
- var while_loading_container_id = node.getAttribute('data-reactive_record_while_loading_container_id');
303
- if (#{!self.is_a?(ReactiveRecord::WhileLoading)} && while_loading_container_id !== null && while_loading_container_id !== "") {
304
- return;
305
- }
306
- var enc_while_loading_container_id = node.getAttribute('data-reactive_record_enclosing_while_loading_container_id');
307
- if (enc_while_loading_container_id !== null && enc_while_loading_container_id !== "") {
308
- var while_loading_container = document.body.querySelector('[data-reactive_record_while_loading_container_id="'+enc_while_loading_container_id+'"]');
309
- if (loading) {
310
- node.className = node.className.replace(/reactive_record_is_loaded/g, '').replace(/ /g, ' ');
311
- if (node.className.indexOf('reactive_record_is_loading') === -1) {
312
- node.className = node.className + ' reactive_record_is_loading';
313
- }
314
- if (while_loading_container !== null) {
315
- while_loading_container.className = while_loading_container.className.replace(/reactive_record_is_loaded/g, '').replace(/ /g, ' ');
316
- if (while_loading_container.className.indexOf('reactive_record_is_loading') === -1) {
317
- while_loading_container.className = while_loading_container.className + ' reactive_record_is_loading';
318
- }
302
+ def reactive_record_link_set_while_loading_container_class
303
+ node = dom_node
304
+ loading = (waiting_on_resources ? `true` : `false`)
305
+ %x{
306
+ if (typeof node === "undefined" || node === null) return;
307
+ var while_loading_container_id = node.getAttribute('data-reactive_record_while_loading_container_id');
308
+ if (#{!self.is_a?(ReactiveRecord::WhileLoading)} && while_loading_container_id !== null && while_loading_container_id !== "") {
309
+ return;
310
+ }
311
+ var enc_while_loading_container_id = node.getAttribute('data-reactive_record_enclosing_while_loading_container_id');
312
+ if (enc_while_loading_container_id !== null && enc_while_loading_container_id !== "") {
313
+ var while_loading_container = document.body.querySelector('[data-reactive_record_while_loading_container_id="'+enc_while_loading_container_id+'"]');
314
+ if (loading) {
315
+ node.className = node.className.replace(/reactive_record_is_loaded/g, '').replace(/ /g, ' ');
316
+ if (node.className.indexOf('reactive_record_is_loading') === -1) {
317
+ node.className = node.className + ' reactive_record_is_loading';
318
+ }
319
+ if (while_loading_container !== null) {
320
+ while_loading_container.className = while_loading_container.className.replace(/reactive_record_is_loaded/g, '').replace(/ /g, ' ');
321
+ if (while_loading_container.className.indexOf('reactive_record_is_loading') === -1) {
322
+ while_loading_container.className = while_loading_container.className + ' reactive_record_is_loading';
319
323
  }
320
- } else if (node.className.indexOf('reactive_record_is_loaded') === -1) {
321
- if (while_loading_container_id === null || while_loading_container_id === "") {
322
- node.className = node.className.replace(/reactive_record_is_loading/g, '').replace(/ /g, ' ');
323
- if (node.className.indexOf('reactive_record_is_loaded') === -1) {
324
- node.className = node.className + ' reactive_record_is_loaded';
325
- }
324
+ }
325
+ } else if (node.className.indexOf('reactive_record_is_loaded') === -1) {
326
+ if (while_loading_container_id === null || while_loading_container_id === "") {
327
+ node.className = node.className.replace(/reactive_record_is_loading/g, '').replace(/ /g, ' ');
328
+ if (node.className.indexOf('reactive_record_is_loaded') === -1) {
329
+ node.className = node.className + ' reactive_record_is_loaded';
326
330
  }
327
- if (while_loading_container.className.indexOf('reactive_record_is_loaded') === -1) {
328
- var loading_children = while_loading_container.querySelectorAll('[data-reactive_record_enclosing_while_loading_container_id="'+enc_while_loading_container_id+'"].reactive_record_is_loading');
329
- if (loading_children.length === 0) {
330
- while_loading_container.className = while_loading_container.className.replace(/reactive_record_is_loading/g, '').replace(/ /g, ' ');
331
- if (while_loading_container.className.indexOf('reactive_record_is_loaded') === -1) {
332
- while_loading_container.className = while_loading_container.className + ' reactive_record_is_loaded';
333
- }
331
+ }
332
+ if (while_loading_container.className.indexOf('reactive_record_is_loaded') === -1) {
333
+ var loading_children = while_loading_container.querySelectorAll('[data-reactive_record_enclosing_while_loading_container_id="'+enc_while_loading_container_id+'"].reactive_record_is_loading');
334
+ if (loading_children.length === 0) {
335
+ while_loading_container.className = while_loading_container.className.replace(/reactive_record_is_loading/g, '').replace(/ /g, ' ');
336
+ if (while_loading_container.className.indexOf('reactive_record_is_loaded') === -1) {
337
+ while_loading_container.className = while_loading_container.className + ' reactive_record_is_loaded';
334
338
  }
335
339
  }
336
340
  }
337
341
  }
338
342
  }
339
- end
343
+ }
340
344
  end
341
345
  end
342
346
  end