Skip to content
Open
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
7 changes: 7 additions & 0 deletions packages/react-devtools-shared/src/devtools/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,7 @@ export default class Store extends EventEmitter<{
id: suspense.id,
environment: environmentName,
endTime: suspense.endTime,
hasUniqueSuspenders: suspense.hasUniqueSuspenders,
};
target.push(rootStep);
} else {
Expand All @@ -983,6 +984,10 @@ export default class Store extends EventEmitter<{
// If any root has a higher end time, let's use that.
rootStep.endTime = suspense.endTime;
}
if (!rootStep.hasUniqueSuspenders) {
// If any root has unique suspenders, the merged root should too.
rootStep.hasUniqueSuspenders = suspense.hasUniqueSuspenders;
}
}
this.pushTimelineStepsInDocumentOrder(
suspense.children,
Expand Down Expand Up @@ -1051,6 +1056,7 @@ export default class Store extends EventEmitter<{
// TODO: Get environment for Activity
environment: null,
endTime: 0,
hasUniqueSuspenders: true,
});

const transitionChildren = this.getSuspenseChildren(focusedTransitionID);
Expand Down Expand Up @@ -1106,6 +1112,7 @@ export default class Store extends EventEmitter<{
id: child.id,
environment: environmentName,
endTime: maxEndTime,
hasUniqueSuspenders: child.hasUniqueSuspenders,
});
}
this.pushTimelineStepsInDocumentOrder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,7 @@
.SuspenseRectsBoundary[data-selected='true'] > .SuspenseRectsRect {
box-shadow: none;
}

.SuspenseRectsBoundaryNotSuspended {
--color-suspense: var(--color-dim);
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ function SuspenseRects({
className={
styles.SuspenseRectsBoundary +
' ' +
getClassNameForEnvironment(environment)
getClassNameForEnvironment(environment) +
(!suspense.hasUniqueSuspenders
? ' ' + styles.SuspenseRectsBoundaryNotSuspended
: '')
}
visible={visible}
selected={selected}
Expand Down Expand Up @@ -550,6 +553,7 @@ function SuspenseRectsContainer({

let selectedBoundingBox = null;
let selectedEnvironment = null;
let selectedHasUniqueSuspenders = true;
if (isRootSelected) {
selectedEnvironment = rootEnvironment;
} else if (
Expand All @@ -563,6 +567,7 @@ function SuspenseRectsContainer({
(selectedSuspenseNode.hasUniqueSuspenders || !uniqueSuspendersOnly)
) {
selectedBoundingBox = getBoundingBox(selectedSuspenseNode.rects);
selectedHasUniqueSuspenders = selectedSuspenseNode.hasUniqueSuspenders;
for (let i = 0; i < timeline.length; i++) {
const timelineStep = timeline[i];
if (timelineStep.id === inspectedElementID) {
Expand Down Expand Up @@ -605,7 +610,10 @@ function SuspenseRectsContainer({
className={
styles.SuspenseRectOutline +
' ' +
getClassNameForEnvironment(selectedEnvironment)
getClassNameForEnvironment(selectedEnvironment) +
(!selectedHasUniqueSuspenders
? ' ' + styles.SuspenseRectsBoundaryNotSuspended
: '')
}
rect={selectedBoundingBox}
adjust={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
background: var(--color-transition);
}

.SuspenseScrubberBeadNotSuspended {
background: color-mix(in srgb, var(--color-dim) 25%, transparent);
}

.SuspenseScrubberBeadNotSuspended.SuspenseScrubberBeadSelected {
background: var(--color-dim);
}

.SuspenseScrubberStepHighlight > .SuspenseScrubberBead {
height: 0.75rem;
transition: all 0.3s ease-out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export default function SuspenseScrubber({
? // The first step in the timeline is always a Transition (Initial Paint).
' ' + styles.SuspenseScrubberBeadTransition
: '') +
(!step.hasUniqueSuspenders
? ' ' + styles.SuspenseScrubberBeadNotSuspended
: '') +
' ' +
getClassNameForEnvironment(environment) +
(index <= value ? ' ' + styles.SuspenseScrubberBeadSelected : '')
Expand Down
1 change: 1 addition & 0 deletions packages/react-devtools-shared/src/frontend/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export type SuspenseTimelineStep = {
id: SuspenseNode['id'] | Element['id'], // TODO: Will become a group.
environment: null | string,
endTime: number,
hasUniqueSuspenders: boolean,
};

export type SuspenseNode = {
Expand Down