Skip to content

Commit ba862df

Browse files
committed
frontend: small refactoring
1 parent 51f6c8e commit ba862df

File tree

1 file changed

+4
-9
lines changed
  • frontends/web/src/routes/account/summary

1 file changed

+4
-9
lines changed

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ export const Chart = ({
175175
formattedData.current = {};
176176

177177
chartData.forEach(entry => {
178-
if (formattedData.current) {
179-
formattedData.current[entry.time as number] = entry.formattedValue;
180-
}
178+
formattedData.current[entry.time as number] = entry.formattedValue;
181179
});
182180
};
183181

@@ -430,16 +428,13 @@ export const Chart = ({
430428
crosshairMarkerRadius: 6,
431429
});
432430
const isChartDisplayWeekly = chartDisplay === 'week';
433-
lineSeries.current.setData(
434-
isChartDisplayWeekly
435-
? data.chartDataHourly
436-
: data.chartDataDaily
437-
);
438-
setFormattedData(
431+
const dataToDisplay = (
439432
isChartDisplayWeekly
440433
? data.chartDataHourly
441434
: data.chartDataDaily
442435
);
436+
lineSeries.current.setData(dataToDisplay);
437+
setFormattedData(dataToDisplay);
443438
chart.current.timeScale().subscribeVisibleLogicalRangeChange(calculateChange);
444439
chart.current.subscribeCrosshairMove(handleCrosshair);
445440
chart.current.timeScale().fitContent();

0 commit comments

Comments
 (0)