-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Using event.stopPropagation() in withStateHandlers does not work. #602
Comments
This is expected. Line change will not help as it will break atomic setState updates. Use intermediate |
Thanks @istarkov. It's very surprising, though, lost some time to this. In theory it would be possible to swap the order of the curried arguments, right?
|
@philipnilsson thanks for your advice. I think swapping the order of the arguments do help. Besides, there is no need to call @istarkov how do you think? |
How come withStateHandlers was introduced with incorrect call order for stateUpdaters in the first place! It seems obvious that setState should be called inside event handler, and not other way round. |
Expected
This code will stop event-propagation.
Actual
It doesn't
Cause
Handlers are run asynchronously inside a
setState
closure, and sostopPropagation
is not called on time.Solution
Change this line to run handlers eagerly, and not inside the closure.
The text was updated successfully, but these errors were encountered: