function requestWork(root, expirationTime) {
    if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
      invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');
    }

    // Add the root to the schedule.
    // Check if this root is already part of the schedule.
    if (root.nextScheduledRoot === null) {
      // This root is not already scheduled. Add it.
      root.remainingExpirationTime = expirationTime;
      if (lastScheduledRoot === null) {
        firstScheduledRoot = lastScheduledRoot = root;
        root.nextScheduledRoot = root;
      } else {
        lastScheduledRoot.nextScheduledRoot = root;
        lastScheduledRoot = root;
        lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
      }
    } else {
      // This root is already scheduled, but its priority may have increased.
      var remainingExpirationTime = root.remainingExpirationTime;
      if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) {
        // Update the priority.
        root.remainingExpirationTime = expirationTime;
      }
    }

    if (isRendering) {
      // Prevent reentrancy. Remaining work will be scheduled at the end of
      // the currently rendering batch.
      return;
    }

    if (isBatchingUpdates) {
      // Flush work at the end of the batch.
      if (isUnbatchingUpdates) {
        // ...unless we're inside unbatchedUpdates, in which case we should
        // flush it now.
        performWorkOnRoot(root, Sync);
      }
      return;
    }

    // TODO: Get rid of Sync and use current time?
    if (expirationTime === Sync) {
      performWork(Sync, null);
    } else if (!isCallbackScheduled) {
      isCallbackScheduled = true;
      startRequestCallbackTimer();
      scheduleDeferredCallback(performAsyncWork);
    }
  }
function requestWork(root, expirationTime) {
    if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
      invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');
    }

    // Add the root to the schedule.
    // Check if this root is already part of the schedule.
    if (root.nextScheduledRoot === null) {
      // This root is not already scheduled. Add it.
      root.remainingExpirationTime = expirationTime;
      if (lastScheduledRoot === null) {
        firstScheduledRoot = lastScheduledRoot = root;
        root.nextScheduledRoot = root;
      } else {
        lastScheduledRoot.nextScheduledRoot = root;
        lastScheduledRoot = root;
        lastScheduledRoot.nextScheduledRoot = firstScheduledRoot;
      }
    } else {
      // This root is already scheduled, but its priority may have increased.
      var remainingExpirationTime = root.remainingExpirationTime;
      if (remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime) {
        // Update the priority.
        root.remainingExpirationTime = expirationTime;
      }
    }

    if (isRendering) {
      // Prevent reentrancy. Remaining work will be scheduled at the end of
      // the currently rendering batch.
      return;
    }

    if (isBatchingUpdates) {
      // Flush work at the end of the batch.
      if (isUnbatchingUpdates) {
        // ...unless we're inside unbatchedUpdates, in which case we should
        // flush it now.
        performWorkOnRoot(root, Sync);
      }
      return;
    }

    // TODO: Get rid of Sync and use current time?
    if (expirationTime === Sync) {
      performWork(Sync, null);
    } else if (!isCallbackScheduled) {
      isCallbackScheduled = true;
      startRequestCallbackTimer();
      scheduleDeferredCallback(performAsyncWork);
    }
  }
function requestWork ( root , expirationTime ) { if ( nestedUpdateCount > NESTED_UPDATE_LIMIT ) { invariant ( false , 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.' ) ; } // Add the root to the schedule. // Check if this root is already part of the schedule. if ( root . nextScheduledRoot === null ) { // This root is not already scheduled. Add it. root . remainingExpirationTime = expirationTime ; if ( lastScheduledRoot === null ) { firstScheduledRoot = lastScheduledRoot = root ; root . nextScheduledRoot = root ; } else { lastScheduledRoot . nextScheduledRoot = root ; lastScheduledRoot = root ; lastScheduledRoot . nextScheduledRoot = firstScheduledRoot ; } } else { // This root is already scheduled, but its priority may have increased. var remainingExpirationTime = root . remainingExpirationTime ; if ( remainingExpirationTime === NoWork || expirationTime < remainingExpirationTime ) { // Update the priority. root . remainingExpirationTime = expirationTime ; } } if ( isRendering ) { // Prevent reentrancy. Remaining work will be scheduled at the end of // the currently rendering batch. return ; } if ( isBatchingUpdates ) { // Flush work at the end of the batch. if ( isUnbatchingUpdates ) { // ...unless we're inside unbatchedUpdates, in which case we should // flush it now. performWorkOnRoot ( root , Sync ) ; } return ; } // TODO: Get rid of Sync and use current time? if ( expirationTime === Sync ) { performWork ( Sync , null ) ; } else if ( ! isCallbackScheduled ) { isCallbackScheduled = true ; startRequestCallbackTimer ( ) ; scheduleDeferredCallback ( performAsyncWork ) ; } }
requestWork is called by the scheduler whenever a root receives an update. It's up to the renderer to call renderRoot at some point in the future.
requestWork is called by the scheduler whenever a root receives an update . It s up to the renderer to call renderRoot at some point in the future .