Skip to content

Commit 677662b

Browse files
committed
frontend: set data source to hourly on mount if display is week
Our chart uses `daily` as its `source` default state value. Instead, we need to make sure to set this `source` state to the appropriate value according to the stored `chartDisplay` in the context. Other than as a best practice, this fixes an edge case bug. Such as wrong data & difference displayed when user does the following: 1. picks USD as default currency, 2. navigate to a different page, 3. and going back to account summary.
1 parent 40f494b commit 677662b

File tree

1 file changed

+3
-0
lines changed
  • frontends/web/src/routes/account/summary

1 file changed

+3
-0
lines changed

frontends/web/src/routes/account/summary/chart.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class Chart extends Component<Props, State> {
9393
};
9494

9595
public componentDidMount() {
96+
if (this.state.source !== 'hourly' && this.context.chartDisplay === 'week') {
97+
this.setState({ source: 'hourly' });
98+
}
9699
this.createChart();
97100
}
98101

0 commit comments

Comments
 (0)