Got this debugging another error. Filing here for reference. Original code: https://phabricator.intern.facebook.com/P59317705
invariant(
      !isRendering,
      'flushSync was called from inside a lifecycle method. It cannot be ' +
        'called when React is already rendering.',
    );
    const previousIsBatchingUpdates = isBatchingUpdates;
    isBatchingUpdates = true;
    try {
      return syncUpdates(fn, a);
    } finally {
      isBatchingUpdates = previousIsBatchingUpdates;
      performSyncWork();
    }
  }
  function interactiveUpdates<A, B, R>(fn: (A, B) => R, a: A, b: B): R {
    if (isBatchingInteractiveUpdates) {
      return fn(a, b);
    }
    
    
    
    
    if (