Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ import {createBoundServerReference} from './ReactFlightReplyClient';

import {readTemporaryReference} from './ReactFlightTemporaryReferences';

import {logComponentRender} from './ReactFlightPerformanceTrack';
import {
markAllTracksInOrder,
logComponentRender,
} from './ReactFlightPerformanceTrack';

import {
REACT_LAZY_TYPE,
Expand Down Expand Up @@ -643,6 +646,7 @@ export function reportGlobalError(response: Response, error: Error): void {
}
});
if (enableProfilerTimer && enableComponentPerformanceTrack) {
markAllTracksInOrder();
flushComponentPerformance(getChunk(response, 0), 0, -Infinity);
}
}
Expand Down
20 changes: 20 additions & 0 deletions packages/react-client/src/ReactFlightPerformanceTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ const supportsUserTiming =

const COMPONENTS_TRACK = 'Server Components ⚛';

const componentsTrackMarker = {
startTime: 0.001,
detail: {
devtools: {
color: 'primary-light',
track: 'Primary',
trackGroup: COMPONENTS_TRACK,
},
},
};

export function markAllTracksInOrder() {
if (supportsUserTiming) {
// Ensure we create the Server Component track groups earlier than the Client Scheduler
// and Client Components. We can always add the 0 time slot even if it's in the past.
// That's still considered for ordering.
performance.mark('Server Components Track', componentsTrackMarker);
}
}

// Reused to avoid thrashing the GC.
const reusableComponentDevToolDetails = {
color: 'primary',
Expand Down
8 changes: 4 additions & 4 deletions packages/react-reconciler/src/ReactFiberPerformanceTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function setCurrentTrackFromLanes(lanes: Lanes): void {
}

const blockingLaneMarker = {
startTime: 0,
startTime: 0.003,
detail: {
devtools: {
color: 'primary-light',
Expand All @@ -74,7 +74,7 @@ const blockingLaneMarker = {
};

const transitionLaneMarker = {
startTime: 0,
startTime: 0.003,
detail: {
devtools: {
color: 'primary-light',
Expand All @@ -85,7 +85,7 @@ const transitionLaneMarker = {
};

const suspenseLaneMarker = {
startTime: 0,
startTime: 0.003,
detail: {
devtools: {
color: 'primary-light',
Expand All @@ -96,7 +96,7 @@ const suspenseLaneMarker = {
};

const idleLaneMarker = {
startTime: 0,
startTime: 0.003,
detail: {
devtools: {
color: 'primary-light',
Expand Down
Loading