Warning: flushSync was called from inside a lifecycle method
See original GitHub issueVersion
6.0.0-alpha.11
Steps to reproduce
It happens in a fairly large project, but not on CodeSandbox sample, and I did not have time to bisect properly. If it’s obvious to you what the issue is, great, otherwise feel free to close and I will re-open when I have a better repro.
Fwiw, it does not happen with 5.x.
Actual Behavior
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.
Menu2
Overlay2
div
RootClose2
TypeaheadManager2
Typeahead2
TypeaheadComponent2
MyComponent
Issue Analytics
- State:
- Created a year ago
- Reactions:11
- Comments:12 (3 by maintainers)
Top Results From Across the Web
flushSync React warning occurs on render() for Modal that ...
Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call ...
Read more >react-bootstrap-typeahead error: flushSync was called from ...
js:24447 Uncaught Error: flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering. Below is the ......
Read more >Have you used `flushSync` in React? - DEV Community
To use flushSync , we need to import it from react-dom : import { flushSync } from "react-dom";. And now we can wrap...
Read more >Warning: flushSync was called from inside a lifecycle method
Version. 6.0.0-alpha.11. Steps to reproduce. It happens in a fairly large project, but not on CodeSandbox sample, and I did not have time...
Read more >React flushSync() - CodingShower
The ReactDOM.flushSync(callback) API method synchronously flushes all the updates inside the callback passed, into the DOM immediately.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe it’s related to node/npm version. I’m using node v16.14.0 and npm v8.3.1. on my dev machine.
I think this should be fixed in v6.0.0-rc.3; I can no longer repro the issue in a sandbox using that version. I believe the issue was caused by
Menu
inadvertently calling PopperJS’sforceUpdate
function on every render, which shouldn’t happen any more.