Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rationale for using flushSync? #211

Open
csvan opened this issue Oct 14, 2023 · 1 comment
Open

Rationale for using flushSync? #211

csvan opened this issue Oct 14, 2023 · 1 comment

Comments

@csvan
Copy link

csvan commented Oct 14, 2023

Noticed that internals of this hook use flushSync to force updates, but is there a strong reason for this as opposed to other approaches?

FlushSync use is generally discouraged and dubbed a last resort by the React documentation. It is also known to crash the entire app in certain circumstances due to React internals throwing.

I would be happy to provide a PR getting rid of this if the use case could be explained.

@robtaussig
Copy link
Owner

Hi @csvan ,

I apologize for the late reply. I added it in response to this issue, but otherwise had no strong motivation for it. Professionally, I've never had to use flushSync, so I'm not familiar with its caveats/pitfalls. Would be happy to see a PR from you to remove it if you don't think it is necessary anymore!

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

No branches or pull requests

2 participants