(fn: (() => R) | void)
| 91 | declare function flushSyncFromReconciler<R>(fn: () => R): R; |
| 92 | declare function flushSyncFromReconciler(): void; |
| 93 | function 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 | |
| 107 | const flushSync: typeof flushSyncIsomorphic = disableLegacyMode |
| 108 | ? flushSyncIsomorphic |
nothing calls this directly
no test coverage detected