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

Get data by latest

parent 37744b77
No related branches found
No related tags found
1 merge request!507Delrifai/#394 2 add charts to balance history
......@@ -30,7 +30,7 @@ interface Operation {
const prepareData = (operations: Operation[]) => {
if (!operations || operations.length === 0) return [];
const dailyData = new Map<string, { balance: number; balance_change: number }>();
operations.forEach((operation: any) => {
......@@ -155,14 +155,14 @@ export default function BalanceHistory() {
paramsState.coinType,
undefined,
5000, // Default size for chart data
"asc",
"desc",
effectiveFromBlock,
effectiveToBlock
);
// Use useMemo to memoize the prepared data so it only recalculates when chartData changes
const preparedData = useMemo(() => {
return chartData ? prepareData(chartData.operations_result) : [];
return chartData ? prepareData(chartData.operations_result.slice().reverse()) : [];
}, [chartData]); // This will only recompute when chartData changes
let message = "";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment