Skip to content

Handling refreshes when callback may be called either synchronously or asynchronously? #202

Answered by brainkim
GormanFletcher asked this question in Q&A
Discussion options

You must be logged in to vote

resulting in the Component is already executing error

Technically, this is not a runtime error but a console “error.” Refreshes which are detected to occur while components are already executing are turned into no-ops, because if we just re-executed the component, we’d likely end up with an infinite loop. At the same time I was seeing people write refresh calls directly in the main function anyways, so I added this console error to discourage the practice.

I admit that I didn’t really think about the use-case of a zalgo-unleashing callback, but I can’t say that I care too much that a warning is emitted when you have an API whose callbacks run synchronously or asynchronously. Essentially…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@GormanFletcher
Comment options

@brainkim
Comment options

@GormanFletcher
Comment options

@brainkim
Comment options

Answer selected by GormanFletcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants