Skip to content

Commit

Permalink
fix(explorer): don't show stale data when switching to a view without…
Browse files Browse the repository at this point in the history
… variables
  • Loading branch information
marcelgerber committed Jul 3, 2024
1 parent 06849a9 commit 507131d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 9 additions & 3 deletions explorer/Explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,15 @@ export class Explorer
grapher.reset()
this.updateGrapherFromExplorerCommon()
grapher.updateFromObject(config)
await grapher.downloadLegacyDataFromOwidVariableIds(
inputTableTransformer
)
if (dimensions.length === 0) {
// If dimensions are empty, explicitly set the table to an empty table
// so we don't end up confusingly showing stale data from a previous chart
grapher.receiveOwidData(new Map())
} else {
await grapher.downloadLegacyDataFromOwidVariableIds(
inputTableTransformer
)
}
}

@action.bound private updateGrapherFromExplorerUsingColumnSlugs() {
Expand Down
5 changes: 1 addition & 4 deletions packages/@ourworldindata/core-table/src/OwidTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1051,10 +1051,7 @@ export class OwidTable extends CoreTable<OwidRow, OwidColumnDef> {
}

get isBlank(): boolean {
return (
this.tableDescription.startsWith(BLANK_TABLE_MESSAGE) &&
!this.numRows
)
return !this.numRows
}
}

Expand Down

0 comments on commit 507131d

Please sign in to comment.