diff --git a/packages/react-reconciler/src/SchedulingProfiler.js b/packages/react-reconciler/src/SchedulingProfiler.js index c6032014a198f..bb78ca655461f 100644 --- a/packages/react-reconciler/src/SchedulingProfiler.js +++ b/packages/react-reconciler/src/SchedulingProfiler.js @@ -15,6 +15,7 @@ import { enableSchedulingProfiler, enableSchedulingProfilerComponentStacks, } from 'shared/ReactFeatureFlags'; +import ReactVersion from 'shared/ReactVersion'; import getComponentName from 'shared/getComponentName'; import {getStackByFiberInDevAndProd} from './ReactFiberComponentStack'; @@ -166,7 +167,9 @@ export function markRenderStopped(): void { export function markRenderScheduled(lane: Lane): void { if (enableSchedulingProfiler) { if (supportsUserTiming) { - performance.mark(`--schedule-render-${formatLanes(lane)}`); + performance.mark( + `--schedule-render-${formatLanes(lane)}-${ReactVersion}`, + ); } } } diff --git a/packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js b/packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js index 3afc4bfb5443c..1a4ad9cf08b68 100644 --- a/packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js +++ b/packages/react-reconciler/src/__tests__/SchedulingProfiler-test.internal.js @@ -10,6 +10,8 @@ 'use strict'; +import ReactVersion from 'shared/ReactVersion'; + function normalizeCodeLocInfo(str) { return ( str && @@ -81,7 +83,7 @@ describe('SchedulingProfiler', () => { ReactTestRenderer.create(
); expect(marks).toEqual([ - '--schedule-render-1', + `--schedule-render-1-${ReactVersion}`, '--render-start-1', '--render-stop', '--commit-start-1', @@ -95,7 +97,7 @@ describe('SchedulingProfiler', () => { it('should mark concurrent render without suspends or state updates', () => { ReactTestRenderer.create(, {unstable_isConcurrent: true}); - expect(marks).toEqual(['--schedule-render-512']); + expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]); marks.splice(0); @@ -128,7 +130,7 @@ describe('SchedulingProfiler', () => { expect(ReactNoop.flushNextYield()).toEqual(['Foo']); expect(marks).toEqual([ - '--schedule-render-512', + `--schedule-render-512-${ReactVersion}`, '--render-start-512', '--render-yield', ]); @@ -148,7 +150,7 @@ describe('SchedulingProfiler', () => { ); expect(marks).toEqual([ - '--schedule-render-1', + `--schedule-render-1-${ReactVersion}`, '--render-start-1', toggleComponentStacks( '--suspense-suspend-0-Example-\n at Example\n at Suspense', @@ -184,7 +186,7 @@ describe('SchedulingProfiler', () => { ); expect(marks).toEqual([ - '--schedule-render-1', + `--schedule-render-1-${ReactVersion}`, '--render-start-1', toggleComponentStacks( '--suspense-suspend-0-Example-\n at Example\n at Suspense', @@ -220,7 +222,7 @@ describe('SchedulingProfiler', () => { {unstable_isConcurrent: true}, ); - expect(marks).toEqual(['--schedule-render-512']); + expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]); marks.splice(0); @@ -262,7 +264,7 @@ describe('SchedulingProfiler', () => { {unstable_isConcurrent: true}, ); - expect(marks).toEqual(['--schedule-render-512']); + expect(marks).toEqual([`--schedule-render-512-${ReactVersion}`]); marks.splice(0); @@ -304,7 +306,7 @@ describe('SchedulingProfiler', () => { ReactTestRenderer.create(