Skip to content

Commit

Permalink
fix(trace-list): more rigorous sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Quacken8 committed Aug 5, 2024
1 parent 9a49587 commit 78c1459
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/data/trace-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,13 +953,17 @@ export class TraceList {
});
}

const metas = this.calculateStatistics();
const metas = new Map(
this.calculateStatistics().map((s) => [s.traceId, s]),
);

return new TraceList({
...this.#params,
handles: this.#params.handles.toSorted((a, b) => {
const aValue = toNumeric(metas[a][by], this.yDataUnit);
const bValue = toNumeric(metas[b][by], this.yDataUnit);
const aID = variantIds.get(a)!;
const bID = variantIds.get(b)!;
const aValue = toNumeric(metas.get(aID)![by], this.yDataUnit);
const bValue = toNumeric(metas.get(bID)![by], this.yDataUnit);
return (aValue - bValue) * direction;
}),
});
Expand Down

0 comments on commit 78c1459

Please sign in to comment.