Skip to content

Commit

Permalink
Fix nav index
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Jan 14, 2025
1 parent 04bbd2c commit bebd123
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions centrifuge-js/src/modules/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3987,7 +3987,8 @@ export function getPoolsModule(inst: Centrifuge) {
combineLatestWith(getPoolCurrency([poolId])),
map(([data, poolCurrency]) => {
return data?.epoches?.nodes.map((order) => {
const index = order.epochStates.nodes.length - 1
const index = order.epochStates.nodes.length > 1 ? order.epochStates.nodes.length - 1 : 0
const snapshotIndex = order.poolSnapshots.nodes.length > 1 ? order.poolSnapshots.nodes.length - 1 : 0
return {
epochId: order.id,
closedAt: order.closedAt,
Expand All @@ -4010,10 +4011,7 @@ export function getPoolsModule(inst: Centrifuge) {
? new CurrencyBalance(order.epochStates.nodes[index].sumFulfilledRedeemOrders, poolCurrency.decimals)
: null,
netAssetValue: order.poolSnapshots.nodes.length
? new CurrencyBalance(
order.poolSnapshots.nodes[order.poolSnapshots.nodes.length - 1].netAssetValue,
poolCurrency.decimals
)
? new CurrencyBalance(order.poolSnapshots.nodes[snapshotIndex].netAssetValue, poolCurrency.decimals)
: null,
}
})
Expand Down

0 comments on commit bebd123

Please sign in to comment.