(fn: A => R, a: A)
| 1761 | } |
| 1762 | |
| 1763 | export function batchedUpdates<A, R>(fn: A => R, a: A): R { |
| 1764 | if (disableLegacyMode) { |
| 1765 | // batchedUpdates is a no-op now, but there's still some internal react-dom |
| 1766 | // code calling it, that we can't remove until we remove legacy mode. |
| 1767 | return fn(a); |
| 1768 | } else { |
| 1769 | const prevExecutionContext = executionContext; |
| 1770 | executionContext |= BatchedContext; |
| 1771 | try { |
| 1772 | return fn(a); |
| 1773 | } finally { |
| 1774 | executionContext = prevExecutionContext; |
| 1775 | // If there were legacy sync updates, flush them at the end of the outer |
| 1776 | // most batchedUpdates-like method. |
| 1777 | if ( |
| 1778 | executionContext === NoContext && |
| 1779 | // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. |
| 1780 | !(__DEV__ && ReactSharedInternals.isBatchingLegacy) |
| 1781 | ) { |
| 1782 | resetRenderTimer(); |
| 1783 | flushSyncWorkOnLegacyRootsOnly(); |
| 1784 | } |
| 1785 | } |
| 1786 | } |
| 1787 | } |
| 1788 | |
| 1789 | export function discreteUpdates<A, B, C, D, R>( |
| 1790 | fn: (A, B, C, D) => R, |
nothing calls this directly
no test coverage detected