Skip to content

Commit

Permalink
refactor: guard against an empty list of tables
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Nov 28, 2023
1 parent 1916ae5 commit b93a052
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@ourworldindata/grapher/src/lineCharts/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import {
CoreValueType,
isNotErrorValue,
EntityName,
BlankOwidTable,
} from "@ourworldindata/core-table"
import {
autoDetectSeriesStrategy,
Expand Down Expand Up @@ -311,6 +312,9 @@ export class LineChart
const groupedByEntity = table
.groupBy("entityName")
.filter((t) => !t.hasAnyColumnNoValidValue(this.yColumnSlugs))

if (groupedByEntity.length === 0) return BlankOwidTable()

table = groupedByEntity[0].concat(groupedByEntity.slice(1))
}

Expand Down

0 comments on commit b93a052

Please sign in to comment.