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

Bug: Synchronously Restart Render on Error During Async Rendering to Prevent Inconsistencies #32167

Open
farhan-labib09 opened this issue Jan 23, 2025 · 2 comments
Labels
Resolution: Needs More Information Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@farhan-labib09
Copy link

farhan-labib09 commented Jan 23, 2025

Synchronously restart when an error is thrown during async rendering

Description

In async mode, events are interleaved with rendering. If an event mutates state that is later accessed during render, it can cause inconsistencies. Restarting the render synchronously resolves the inconsistency and prevents further mutations during interleaved events.

Steps to Reproduce

  1. Enable async rendering mode.
  2. Trigger an event that mutates state during rendering.
  3. Observe inconsistencies during the render process.

Expected Behavior

The render should restart synchronously to prevent inconsistencies and further mutations from interfering.

Actual Behavior

Inconsistent rendering occurs, leading to potential UI issues or errors.

Suggested Fix

Implement synchronous restart of the render when an error is thrown during async rendering to handle the interleaved events and ensure consistency.

@farhan-labib09 farhan-labib09 added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jan 23, 2025
@farhan-labib09
Copy link
Author

The bug arises because, in async mode, events are interleaved with rendering. If an event mutates state accessed later in the render, it can lead to inconsistencies. Restarting the render synchronously helps fix the inconsistency and prevents further mutations during interleaved events.

@eps1lon
Copy link
Collaborator

eps1lon commented Jan 23, 2025

It doesn't look like this bug report has enough info for one of us to reproduce it.

Please provide a CodeSandbox (https://react.new), or a link to a repository on GitHub.

Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Needs More Information Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

2 participants