@@ -19,6 +19,18 @@ def bulk_update
1919 @bulk_update_flag = saved_bulk_update_flag
2020 end
2121
22+ # React already will batch together updates inside of event handlers
23+ # so we don't have to, and having Hyperstack batch them outside of the
24+ # event handler causes INPUT/TEXT/SELECT s not to work properly.
25+ # This method is called by the Component event wrapper.
26+ def ignore_bulk_updates ( *args )
27+ saved_ignore_bulk_update_flag = @ignore_bulk_update_flag
28+ @ignore_bulk_update_flag = true
29+ yield ( *args )
30+ ensure
31+ @ignore_bulk_update_flag = saved_ignore_bulk_update_flag
32+ end
33+
2234 def set_state2 ( object , name , value , updates , exclusions = nil )
2335 # set object's name state to value, tell all observers it has changed.
2436 # Observers must implement update_react_js_state
@@ -59,7 +71,7 @@ def get_state(object, name, current_observer = @current_observer)
5971 def set_state ( object , name , value , delay = ALWAYS_UPDATE_STATE_AFTER_RENDER )
6072 states [ object ] [ name ] = value
6173 delay = false if object . respond_to? ( :set_state_synchronously? ) && object . set_state_synchronously?
62- if delay || @bulk_update_flag
74+ if ! @ignore_bulk_update_flag && ( delay || @bulk_update_flag )
6375 @delayed_updates ||= Hash . new { |h , k | h [ k ] = { } }
6476 @delayed_updates [ object ] [ name ] = [ value , Set . new ]
6577 @delayed_updater ||= after ( 0.001 ) do
@@ -80,6 +92,8 @@ def set_state(object, name, value, delay=ALWAYS_UPDATE_STATE_AFTER_RENDER)
8092 updates . each { |observer , args | observer . update_react_js_state ( *args ) }
8193 end
8294 value
95+ ensure
96+ 'Disabling JIT for Safari bug'
8397 end
8498
8599 def will_be_observing? ( object , name , current_observer )
0 commit comments