Under certain conditions we decrement the `__count` attribute too often, which can result in `onInteractionScheduledWorkCompleted` being called prematurely and/or more than once for a given interaction.

- [x] Track interactions scheduled during (sync) render phase.
- [x] Do not double-decrement suspense loads within a sync render.
- [x] Do not decrement sync commits that are waiting on suspense when the `Placeholder` is past its expiration.
- [x] Properly decrement pending interaction count when a suspense resource loads before its placeholder is shown.
- [x] Add test with high priority render between suspended and resolved suspense states (for both sync and async rendering)
legacyErrorBoundariesThatAlreadyFailed !== null &&
    legacyErrorBoundariesThatAlreadyFailed.has(instance)
  );
}
function markLegacyErrorBoundaryAsFailed(instance: mixed) {
  if (legacyErrorBoundariesThatAlreadyFailed === null) {
    legacyErrorBoundariesThatAlreadyFailed = new Set([instance]);
  } else {
    legacyErrorBoundariesThatAlreadyFailed.add(instance);
  }
}
function commitRoot(root: FiberRoot, finishedWork: Fiber): void {
  isWorking = true;
  isCommitting = true;
  startCommitTimer();
  invariant(
    root.current !== finishedWork,
    'Cannot commit the same tree as before. This is probably a bug ' +
      'related to the return field. This error is likely caused by a bug ' +
      'in React. Please file an issue.',
  );
  const committedExpirationTime = root.pendingCommitExpirationTime;
  invariant(
    committedExpirationTime !== NoWork,
    'Cannot commit an incomplete root. This error is likely caused by a ' +
      'bug in React. Please file an issue.',
  );
  root.pendingCommitExpirationTime = NoWork;