MCPcopy
hub / github.com/facebook/react / flushSyncFromReconciler

Function flushSyncFromReconciler

packages/react-dom/src/client/ReactDOMClientFB.js:93–105  ·  view source on GitHub ↗
(fn: (() => R) | void)

Source from the content-addressed store, hash-verified

91declare function flushSyncFromReconciler<R>(fn: () => R): R;
92declare function flushSyncFromReconciler(): void;
93function flushSyncFromReconciler<R>(fn: (() => R) | void): R | void {
94 if (__DEV__) {
95 if (isAlreadyRendering()) {
96 console.error(
97 'flushSync was called from inside a lifecycle method. React cannot ' +
98 'flush when React is already rendering. Consider moving this call to ' +
99 'a scheduler task or micro task.',
100 );
101 }
102 }
103 // $FlowFixMe[incompatible-call]
104 return flushSyncWithoutWarningIfAlreadyRendering(fn);
105}
106
107const flushSync: typeof flushSyncIsomorphic = disableLegacyMode
108 ? flushSyncIsomorphic

Callers

nothing calls this directly

Calls 2

isAlreadyRenderingFunction · 0.85
errorMethod · 0.65

Tested by

no test coverage detected