Skip to content

Commit

Permalink
perf: only sort at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Aug 29, 2024
1 parent 5e05a3d commit 7bb41e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@ourworldindata/core-table/src/OwidTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class OwidTable extends CoreTable<OwidRow, OwidColumnDef> {
}

// Does a stable sort by time. You can refer to this table for fast time filtering.
@imemo private get sortedByTime(): this {
@imemo get sortedByTime(): this {
if (this.timeColumn.isMissing) return this
return this.sortBy([this.timeColumn.slug])
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ export class Grapher
if (this.isSlopeChart)
return table.filterByTargetTimes([startTime, endTime])

return table.filterByTimeRange(startTime, endTime)
return table.filterByTimeRange(startTime, endTime).sortedByTime
}

@computed get transformedTable(): OwidTable {
Expand Down

0 comments on commit 7bb41e4

Please sign in to comment.