Skip to content
Snippets Groups Projects
Commit 2d2d5987 authored by Dima Rifai's avatar Dima Rifai
Browse files

Check if empty or not before slice

parent 958fc449
No related branches found
No related tags found
1 merge request!507Delrifai/#394 2 add charts to balance history
Pipeline #112329 failed
...@@ -162,7 +162,7 @@ export default function BalanceHistory() { ...@@ -162,7 +162,7 @@ export default function BalanceHistory() {
// Use useMemo to memoize the prepared data so it only recalculates when chartData changes // Use useMemo to memoize the prepared data so it only recalculates when chartData changes
const preparedData = useMemo(() => { const preparedData = useMemo(() => {
return chartData ? prepareData(chartData.operations_result.slice().reverse()) : []; return chartData ? prepareData(chartData.operations_result?.slice().reverse()) : [];
}, [chartData]); // This will only recompute when chartData changes }, [chartData]); // This will only recompute when chartData changes
let message = ""; let message = "";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment