Skip to content

Commit

Permalink
Fix loading issues (#110)
Browse files Browse the repository at this point in the history
* Fix translation list loading

* Fix accounts list loading
  • Loading branch information
selankon authored Aug 23, 2024
1 parent 6a1b53f commit 81ac870
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/components/Accounts/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export const AccountCard = ({ id, ...rest }: IAccountCardProps) => {
)
}

const AccountCardSkeleton = ({ electionCount: ec, ...rest }: IAccountCardProps) => {
const AccountCardSkeleton = ({ electionCount: ec, id, ...rest }: IAccountCardProps) => {
const { organization, loading } = useOrganization()
const { t } = useTranslation()

const electionCount = ec ?? organization?.electionIndex
const pid = organization?.address
const pid = id ?? organization?.address

if (!pid) return null

Expand Down
4 changes: 2 additions & 2 deletions src/components/Accounts/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ export const AccountsList = () => {

return (
<>
{orgs?.organizations.map((org) => (
<AccountCard key={org.organizationID} id={org.organizationID} electionCount={org.electionCount} />
{orgs?.organizations.map((org, i) => (
<AccountCard key={i} id={org.organizationID} electionCount={org.electionCount} />
))}
<RoutedPagination pagination={orgs.pagination} />
</>
Expand Down
1 change: 0 additions & 1 deletion src/components/Process/ProcessList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export const PaginatedProcessList = () => {
}

const ProcessList = () => {
const { t } = useTranslation()
const { page }: { page?: number } = useRoutedPagination()
const { queryParams: processFilters } = useQueryParams<FilterQueryParams>()

Expand Down
11 changes: 3 additions & 8 deletions src/components/Transactions/TransactionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ export const PaginatedTransactionList = () => {
}
const TransactionsList = () => {
const { page }: { page?: number } = useRoutedPagination()
const { data: count, isLoading: isLoadingCount } = useTransactionsCount()

const totalPages = Math.ceil(count / PaginationItemsPerPage)
const { isLoading: isLoadingCount } = useTransactionsCount()

const {
data,
Expand Down Expand Up @@ -122,16 +120,13 @@ const TransactionsListCards = ({
height?: number
}) => {
const { t } = useTranslation()
if (!data || (data && data.transactions.length <= 0)) {
return <NoResultsError msg={t('blocks.no_txs_on_block', { defaultValue: 'There are no transactions' })} />
}

if (isLoading) {
return <LoadingCards spacing={4} />
}

if (data?.pagination.totalItems === 0) {
return <NoResultsError />
if (data && data.transactions.length <= 0) {
return <NoResultsError msg={t('blocks.no_txs_on_block', { defaultValue: 'There are no transactions' })} />
}

if (isError || !data) {
Expand Down

2 comments on commit 81ac870

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.