Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Call setState onBlur stops event propagation, necessary to use window.setTimeout? or Bug in Flux? #73

Closed
justin808 opened this issue Oct 4, 2014 · 2 comments

Comments

@justin808
Copy link
Contributor

I have an callback for onBlur that will setState, and based on the state, some buttons may be removed from the screen.

The problem is that one of these buttons has a callback that needs to run, and if setState is called from the onBlur callback, then the callback for the button does not run, probably because it's not technically visible. I verified that the button callback works fine if the onBlur callback does not call setState.

I worked around the issue by using a window.setTimout that calls setState after 250ms.

  • Is this the right approach?
  • Or is this a bug in flux that all callbacks don't run?

My expectation is that the all callbacks would run and the setState calls would be cummulative.

Thanks for any advice.

@fisherwebdev
Copy link
Contributor

In what way does this involve the actions, dispatcher or stores?

On Saturday, October 4, 2014, Justin Gordon notifications@github.com
wrote:

I have an callback for onBlur that will setState, and based on the state,
some buttons may be removed from the screen.

The problem is that one of these buttons has a callback that needs to run,
and if setState is called from the onBlur callback, then the callback for
the button does not run, probably because it's not technically visible. I
verified that the button callback works fine if the onBlur callback does
not call setState.

I worked around the issue by using a window.setTimout that calls setState
after 250ms.

  • Is this the right approach?
  • Or is this a bug in flux that all callbacks don't run?

My expectation is that the all callbacks would run and the setState calls
would be cummulative.

Thanks for any advice.


Reply to this email directly or view it on GitHub
#73.

@justin808
Copy link
Contributor Author

Oh! Sorry, I need to put this in the React repo. Late at night when I filed this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants