Error AtlasError Documentation and Resolution

React flushSync called inside a lifecycle method

flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.

React reported that flushSync was called during render or lifecycle work, where React is already in the middle of rendering and cannot synchronously flush again.

React error #187runtime
flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering.
  • flushSync was called during component render.
  • flushSync was used inside useEffect, useLayoutEffect, or a class lifecycle method.
  • Synchronous DOM flushing was attempted while React was already rendering.
  1. Move flushSync into an event handler when possible.
  2. If it cannot happen in an event, defer it with queueMicrotask after the current render completes.
  3. Remove unnecessary flushSync usage and rely on normal React scheduling when possible.
React Docs: Minified React error #187
React error #187 flushSync lifecycle method: causes and fixes | Error Atlas