-
Notifications
You must be signed in to change notification settings - Fork 39
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
Async/await causes a race condition in React #35
Comments
Could you write a test that recreates this bug? Race conditions are flaky to test, but looking at example code will help explain the issue (which I think I've understood but I'm not 100% sure). |
I've encountered this Issue while looking to solve a problem I'm facing on my own app. My use case is that I have a list of preset values that I need to programmatically fill into several atoms of the same family. Inside the |
I'm sorry, I don't have time to write a test. This bug can be easily reproduced by updating two atoms in the same |
#37 does fix this issue, but two tests fail for the async storage, which is to be expected since with the fix |
I have fixed race condition for synchronize storage (like localStorage) in 2.7.0 version. But the problem still exist for async storage. |
When using
useRecoilCallback
and setting multiple atoms using the same atomEffect the current implementation breaks. It will cause a race condition getting the current localStorage value because of the async/await that was added toonSet
andgetState
.This bug causes you to lose state persisted in localStorage
The text was updated successfully, but these errors were encountered: