Got this debugging another error. Filing here for reference. Original code: https://phabricator.intern.facebook.com/P59317705
addRootToSchedule(root, expirationTime);
    if (isRendering) {
      
      
      return;
    }
    if (isBatchingUpdates) {
      
      if (isUnbatchingUpdates) {
        
        
        nextFlushedRoot = root;
        nextFlushedExpirationTime = Sync;
        performWorkOnRoot(root, Sync, false);
      }
      return;
    }
    
    if (expirationTime === Sync) {
      performSyncWork();
    } else {
      scheduleCallbackWithExpiration(expirationTime);
    }
  }
  function addRootToSchedule(root: FiberRoot, expirationTime: ExpirationTime) {
    
    
    if (root.nextScheduledRoot === null) {
      
      root.remainingExpirationTime = expirationTime;