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

fix: revert useRenderer hook to async rendering #272

Closed
wants to merge 3 commits into from

Conversation

vursen
Copy link
Contributor

@vursen vursen commented Nov 14, 2024

Description

Wrapping renderers in flushSync doesn't guarantee that the DOM will be updated synchronously. React may still defer it to a micro task if flushSync was called while rendering was already in progress, which is explained in the suppressed warning:

Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.

When there are many deferred sync renderers (GridColumn) that in turn trigger some async renderers (Select), it can create race conditions that React misinterprets as a possible infinite loop:

Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn’t have a dependency array, or one of the dependencies changes on every render.

Since synchronous rendering isn't guaranteed, it pretty much defeats the purpose of using flushSync in renderers. I think we should rather try to improve web components to support async renderers.

Fixes #255

Type of change

  • Bugfix

@vursen
Copy link
Contributor Author

vursen commented Nov 15, 2024

Closing in favor of #273

@vursen vursen closed this Nov 15, 2024
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

Successfully merging this pull request may close these issues.

Maximum update depth exceeded with AutoGrid columnRendering set to lazy
1 participant