dillon1000/react
Commit
Browse files Always batch updates of like priority within the same event (#13071)
Expiration times are computed by adding to the current time (the start time). However, if two updates are scheduled within the same event, we should treat their start times as simultaneous, even if the actual clock time has advanced between the first and second call. In other words, because expiration times determine how updates are batched, we want all updates of like priority that occur within the same event to receive the same expiration time. Otherwise we get tearing. We keep track of two separate times: the current "renderer" time and the current "scheduler" time. The renderer time can be updated whenever; it only exists to minimize the calls performance.now. But the scheduler time can only be updated if there's no pending work, or if we know for certain that we're not in the middle of an event.
Changed paths12 files
First-parent comparisonpackages/react-noop-renderer/src/createReactNoop.js ModifiedM packages/react-reconciler/src/ReactFiberClassComponent.js ModifiedM packages/react-reconciler/src/ReactFiberCommitWork.js ModifiedM packages/react-reconciler/src/ReactFiberPendingPriority.js ModifiedM packages/react-reconciler/src/ReactFiberReconciler.js ModifiedM packages/react-reconciler/src/ReactFiberScheduler.js ModifiedM packages/react-reconciler/src/ReactFiberUnwindWork.js ModifiedA packages/react-reconciler/src/__tests__/ReactExpiration-test.internal.js AddedD packages/react-reconciler/src/__tests__/ReactExpiration-test.js DeletedM packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js ModifiedM packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap ModifiedM packages/react/src/__tests__/ReactProfiler-test.internal.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…