Skip to content

Commit

Permalink
Merge pull request #80 from agoric-labs/rs-error-handle-liquidations-…
Browse files Browse the repository at this point in the history
…page

chore add a fallback if item.active does not exist
  • Loading branch information
rabi-siddique authored Jun 7, 2024
2 parents 085cf08 + d3759fd commit 552308b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/pages/Liquidated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ export function Liquidated() {

const graphDataList = populateMissingDays(graphDataMap, GRAPH_DAYS);

const summedGraphDataList = graphDataList.map((item) => ({
...item,
active: sum(Object.values(item.active)),
liquidated: sum(Object.values(item.active)),
}));
const summedGraphDataList = graphDataList.map((item) => {
const totalActive = item.active ? sum(Object.values(item.active)) : 0;
const totalLiquidated = item.liquidated ? sum(Object.values(item.liquidated)) : 0;

return {
...item,
active: totalActive,
liquidated: totalLiquidated
};
});

return (
<>
Expand Down
1 change: 1 addition & 0 deletions src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type FormattedGraphData = {
x: string;
key: number;
active?: any;
liquidated?: any;
};

export type DailyOracles = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export function createNumberWithLeadingZeroes(numOfZeroes: number) {
}
}

export const parseBigInt = (str: string) => Number(str.slice(0, -1));
export const parseBigInt = (str: string) => Number(str?.slice(0, -1));


/**
Expand Down

0 comments on commit 552308b

Please sign in to comment.