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

Function discreteUpdates

packages/react-reconciler/src/ReactFiberWorkLoop.js:1789–1809  ·  view source on GitHub ↗
(
  fn: (A, B, C, D) => R,
  a: A,
  b: B,
  c: C,
  d: D,
)

Source from the content-addressed store, hash-verified

1787}
1788
1789export function discreteUpdates<A, B, C, D, R>(
1790 fn: (A, B, C, D) => R,
1791 a: A,
1792 b: B,
1793 c: C,
1794 d: D,
1795): R {
1796 const prevTransition = ReactSharedInternals.T;
1797 const previousPriority = getCurrentUpdatePriority();
1798 try {
1799 setCurrentUpdatePriority(DiscreteEventPriority);
1800 ReactSharedInternals.T = null;
1801 return fn(a, b, c, d);
1802 } finally {
1803 setCurrentUpdatePriority(previousPriority);
1804 ReactSharedInternals.T = prevTransition;
1805 if (executionContext === NoContext) {
1806 resetRenderTimer();
1807 }
1808 }
1809}
1810
1811// Overload the definition to the two valid signatures.
1812// Warning, this opts-out of checking the function body.

Callers

nothing calls this directly

Calls 4

getCurrentUpdatePriorityFunction · 0.90
setCurrentUpdatePriorityFunction · 0.90
resetRenderTimerFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected