Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fetch transactions from sender and to receiver sequentially #2141

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { TransactionsTableRow } from './TransactionsTableRow'
import { EmptyTransactionHistory } from './EmptyTransactionHistory'
import { MergedTransaction } from '../../state/app/state'
import { useNativeCurrency } from '../../hooks/useNativeCurrency'
import { Loader } from '../common/atoms/Loader'

export const BatchTransferNativeTokenTooltip = ({
children,
Expand Down Expand Up @@ -139,9 +140,8 @@ export const TransactionHistoryTable = (
) => {
const {
transactions,
loading,
completed,
error,
senderData,
receiverData,
failedChainPairs,
resume,
selectedTabIndex,
Expand All @@ -153,7 +153,7 @@ export const TransactionHistoryTable = (
const isTxHistoryEmpty = transactions.length === 0
const isPendingTab = selectedTabIndex === 0

const paused = !loading && !completed
const paused = !senderData.loadingForSender && !senderData.completedForSender

const contentWrapperRef = useRef<HTMLDivElement | null>(null)
const tableRef = useRef<Table | null>(null)
Expand Down Expand Up @@ -194,8 +194,11 @@ export const TransactionHistoryTable = (
if (isTxHistoryEmpty) {
return (
<EmptyTransactionHistory
loading={loading}
isError={typeof error !== 'undefined'}
loading={senderData.loadingForSender || receiverData.loadingForReceiver}
isError={
typeof senderData.errorForSender !== 'undefined' ||
typeof receiverData.errorForReceiver !== 'undefined'
}
paused={paused}
resume={resume}
tabType={isPendingTab ? 'pending' : 'settled'}
Expand All @@ -214,14 +217,26 @@ export const TransactionHistoryTable = (
isPendingTab ? '' : 'rounded-tl-lg'
)}
>
{loading ? (
{senderData.loadingForSender ? (
<div className="flex h-[28px] items-center space-x-2">
<FailedChainPairsTooltip failedChainPairs={failedChainPairs} />
<HistoryLoader />
</div>
) : (
<div className="flex items-center justify-between gap-2">
<div className="flex items-center justify-start space-x-1">
{receiverData.loadingForReceiver && (
<Tooltip
content={
<b className="text-xs">
Inbound transactions received from another address are
still being fetched...
</b>
}
>
<Loader size="small" color="white" />
</Tooltip>
)}
<FailedChainPairsTooltip failedChainPairs={failedChainPairs} />
<span className="text-xs">
Showing {transactions.length}{' '}
Expand All @@ -230,7 +245,9 @@ export const TransactionHistoryTable = (
</span>
</div>

{!completed && <LoadMoreButton onClick={resume} />}
{!senderData.completedForSender && (
<LoadMoreButton onClick={resume} />
)}
</div>
)}
<div>{pendingTokenDepositsCount > 0 && <PendingDepositWarning />}</div>
Expand Down
Loading
Loading