Skip to content

Commit

Permalink
Merge pull request #204 from kaleido-io/tokenPool-details-bug
Browse files Browse the repository at this point in the history
[tokenPool-details-bug]
  • Loading branch information
shorsher authored Nov 14, 2022
2 parents e638e20 + b5d0d9f commit 8162f45
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/pages/Tokens/views/PoolDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ export const PoolDetails: () => JSX.Element = () => {

// Pool balances
useEffect(() => {
if (pool && isMounted) {
if (isMounted && poolID) {
fetchCatcher(
`${FF_Paths.nsPrefix}/${selectedNamespace}${FF_Paths.tokenBalances}?pool=${pool?.id}`
`${FF_Paths.nsPrefix}/${selectedNamespace}${FF_Paths.tokenBalances}?pool=${poolID}`
)
.then(async (balances: ITokenBalance[]) => {
if (balances.length === 0) {
Expand All @@ -167,20 +167,21 @@ export const PoolDetails: () => JSX.Element = () => {
reportFetchError(err);
});
}
}, [pool, isMounted]);
}, [isMounted, poolID]);

// Token transfers and accounts
useEffect(() => {
setTokenTransfers(undefined);

isMounted &&
dateFilter &&
poolID &&
fetchCatcher(
`${FF_Paths.nsPrefix}/${selectedNamespace}${
FF_Paths.tokenTransfers
}?limit=${rowsPerPage}&count&skip=${rowsPerPage * currentPage}${
dateFilter.filterString
}&pool=${pool?.id}`
}&pool=${poolID}`
)
.then(async (tokenTransferRes: IPagedTokenTransferResponse) => {
if (isMounted) {
Expand Down Expand Up @@ -213,7 +214,7 @@ export const PoolDetails: () => JSX.Element = () => {
dateFilter,
currentPage,
selectedNamespace,
pool,
poolID,
isMounted,
]);

Expand Down Expand Up @@ -262,7 +263,8 @@ export const PoolDetails: () => JSX.Element = () => {
const accountsCard: IFireFlyCard = {
headerText: t('accountsInPool'),
clickPath:
pool && FF_NAV_PATHS.tokensBalancesPathByPool(selectedNamespace, pool.id),
poolID &&
FF_NAV_PATHS.tokensBalancesPathByPool(selectedNamespace, poolID),
component: (
<MediumCardTable
records={poolAccountsRecords}
Expand Down Expand Up @@ -396,7 +398,9 @@ export const PoolDetails: () => JSX.Element = () => {
container
>
<Grid container item justifyContent="flex-start" xs={2}>
<Jazzicon diameter={34} seed={jsNumberForAddress(pool.id)} />
{poolID && (
<Jazzicon diameter={34} seed={jsNumberForAddress(poolID)} />
)}
</Grid>
<Grid container item justifyContent="flex-start" xs={10}>
<Typography
Expand Down Expand Up @@ -480,7 +484,7 @@ export const PoolDetails: () => JSX.Element = () => {
dashboardSize
clickPath={FF_NAV_PATHS.tokensTransfersPath(
selectedNamespace,
pool?.id
poolID
)}
/>
</Grid>
Expand Down

0 comments on commit 8162f45

Please sign in to comment.