-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Bug: Dropped update when render phase update happens before suspending #18486
Comments
Sandbox: https://codesandbox.io/s/nostalgic-gauss-xrn4o (If I understand problem correctly) Why didn't you update mirror text with useEffect? |
Generally saying, render phase updates are better for derived state because you don’t need an extra rendering pass for the whole subtree. In either case, it doesn’t matter how else I could write it. The problem is that this uncovers a bug in React, and bugs need to be fixed. |
…t to be dropped (#18537) * Bugfix: Render phase update leads to dropped work Render phase updates should not affect the `fiber.expirationTime` field. We don't have to set anything on the fiber because we're going to process the render phase update immediately. We also shouldn't reset the `expirationTime` field in between render passes because it represents the remaining work left in the update queues. During the re-render, the updates that were skipped in the original pass are not processed again. I think my original motivation for using this field for render phase updates was so I didn't have to add another module level variable. * Add repro case for #18486 Co-authored-by: Dan Abramov <dan.abramov@me.com>
Sandbox: https://codesandbox.io/s/cranky-kapitsa-op3jh
Repro: type "a" and then after a second "b"
Expected: Eventually you'll see "ab" in all fields. Pending "..." indicator goes away.
Actual: You'll keep seeing "a" in low pri field. Pending "..." indicator is stuck.
The text was updated successfully, but these errors were encountered: