Got this debugging another error. Filing here for reference. Original code: https://phabricator.intern.facebook.com/P59317705
deadline = null;
    deadlineDidExpire = false;
    finishRendering();
  }
  function flushRoot(root: FiberRoot, expirationTime: ExpirationTime) {
    invariant(
      !isRendering,
      'work.commit(): Cannot commit while already rendering. This likely ' +
        'means you attempted to commit from inside a lifecycle method.',
    );
    
    
    
    performWorkOnRoot(root, expirationTime, false);
    finishRendering();
  }
  function finishRendering() {
    nestedUpdateCount = 0;
    if (completedBatches !== null) {
      const batches = completedBatches;
      completedBatches = null;
      for (let i = 0; i < batches.length; i++) {
        const batch = batches[i];
        try {
          batch._onComplete();
        } catch (error) {
          if (!hasUnhandledError) {
            hasUnhandledError = true;
            unhandledError = error;