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

[React 19] Async transitions race condition handling #28914

Open
tom-sherman opened this issue Apr 25, 2024 · 0 comments
Open

[React 19] Async transitions race condition handling #28914

tom-sherman opened this issue Apr 25, 2024 · 0 comments
Labels

Comments

@tom-sherman
Copy link

tom-sherman commented Apr 25, 2024

Summary

Repro: https://stackblitz.com/edit/vitejs-vite-ymbqrc?file=src%2FApp.tsx

How do we handle async transitions that resolve out of order? In the above reproduction the search for "a" can resolve after "ab", leading to the input containing "ab" but the results pertaining to "a". In other words, the most recent transition isn't the one that wins.

In other discussions it's been mentioned that this is caused by React losing the context that the setState happens inside a transition as it happens after await. But I'm not sure how to work around this today

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

No branches or pull requests

1 participant