Skip to content

Commit

Permalink
Hide clawback TXs while wallet is syncing (#1951)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsolt-dev committed Jul 27, 2023
1 parent 5cdb606 commit 6139018
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ export default function ClawbackClaimTransactionDialog(props: Props) {
pollingInterval: 10_000,
});
const isSyncing = isWalletSyncLoading || !!walletState?.syncing;
const isSynced = !isSyncing && walletState?.synced;

const { isSubmitting } = methods.formState;

// The fee from EstimatedFee is a string
const canSubmit = !isSyncing && !isSubmitting && !isGetAutoClaimLoading && feeValue !== '';
const canSubmit = isSynced && !isSubmitting && !isGetAutoClaimLoading && feeValue !== '';

function handleClose() {
methods.reset();
Expand Down Expand Up @@ -195,7 +196,7 @@ export default function ClawbackClaimTransactionDialog(props: Props) {
</Alert>
)}

{isSyncing && (
{!isSynced && (
<Alert severity="info" sx={{ marginBottom: 3 }}>
<Trans>Wallet needs to be synced for claiming clawback transactions</Trans>
</Alert>
Expand Down
22 changes: 12 additions & 10 deletions packages/wallets/src/components/WalletHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export default function WalletHistory(props: Props) {

const isLoading = isWalletTransactionsLoading || isWalletLoading;
const isSyncing = isWalletSyncLoading || !walletState || !!walletState?.syncing;
const isSynced = !isSyncing && walletState?.synced;

const [clawbackClaimTransactionDialogProps, setClawbackClaimTransactionDialogProps] = React.useState<{
coinId: string;
Expand Down Expand Up @@ -453,16 +454,17 @@ export default function WalletHistory(props: Props) {
);

const ExtraRowsAfterHeader = useMemo(
() => (
<WalletHistoryPending
walletId={walletId}
cols={cols}
metadata={metadata}
expandedField={expandedField}
expandedCellShift={1}
/>
),
[cols, expandedField, metadata, walletId]
() =>
isSynced && (
<WalletHistoryPending
walletId={walletId}
cols={cols}
metadata={metadata}
expandedField={expandedField}
expandedCellShift={1}
/>
),
[cols, expandedField, metadata, walletId, isSynced]
);

return (
Expand Down

0 comments on commit 6139018

Please sign in to comment.