Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,31 @@ type Props = {
store: Store,
};

function compareTime(a: SerializedAsyncInfo, b: SerializedAsyncInfo): number {
const ioA = a.awaited;
const ioB = b.awaited;
function withIndex(
value: SerializedAsyncInfo,
index: number,
): {
index: number,
value: SerializedAsyncInfo,
} {
return {
index,
value,
};
}

function compareTime(
a: {
index: number,
value: SerializedAsyncInfo,
},
b: {
index: number,
value: SerializedAsyncInfo,
},
): number {
const ioA = a.value.awaited;
const ioB = b.value.awaited;
if (ioA.start === ioB.start) {
return ioA.end - ioB.end;
}
Expand Down Expand Up @@ -364,7 +386,8 @@ export default function InspectedElementSuspendedBy({
minTime = maxTime - 25;
}

const sortedSuspendedBy = suspendedBy === null ? [] : suspendedBy.slice(0);
const sortedSuspendedBy =
suspendedBy === null ? [] : suspendedBy.map(withIndex);
sortedSuspendedBy.sort(compareTime);

let unknownSuspenders = null;
Expand Down Expand Up @@ -407,11 +430,11 @@ export default function InspectedElementSuspendedBy({
<ButtonIcon type="copy" />
</Button>
</div>
{sortedSuspendedBy.map((asyncInfo, index) => (
{sortedSuspendedBy.map(({value, index}) => (
<SuspendedByRow
key={index}
index={index}
asyncInfo={asyncInfo}
asyncInfo={value}
bridge={bridge}
element={element}
inspectedElement={inspectedElement}
Expand Down
Loading