Skip to content

Commit

Permalink
Merge pull request #5528 from LiskHQ/5526-changing-self-stake-crash-w…
Browse files Browse the repository at this point in the history
…allet-page

Prevent crash when a transaction is pending in a row
  • Loading branch information
ManuGowda authored Dec 7, 2023
2 parents b05cb3d + 74d9fc8 commit d186ae5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/modules/transaction/__fixtures__/mockTransactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const transaction = (index) => ({
isFinal: true,
},
confirmations: 22 + index,
executionStatus: 'pending',
executionStatus: 'Successful',
meta: {
recipient: {
address: 'lsktk7bj2yadx5vq3f87gh5cwca7ptpk5djpxhhc3',
Expand Down
15 changes: 11 additions & 4 deletions src/modules/transaction/components/TransactionRow/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ export const ID = ({ isWallet }) => {
);
};

export const Height = () => {
export const Height = ({ t }) => {
const { data } = useContext(TransactionRowContext);
return <span>{data.block.height}</span>;

const isPending = data.executionStatus === 'pending';
if (isPending || !data.block?.height) {
return <Spinner completed={isPending || data.block?.isFinal} label={t('Pending...')} />;
}

return <span>{data.block?.height || '-'}</span>;
};

export const Round = () => {
Expand Down Expand Up @@ -133,9 +139,10 @@ export const Counterpart = () => {

export const Date = ({ t }) => {
const { data } = useContext(TransactionRowContext);
const isPending = data.executionStatus === 'pending';

if (!data.block.timestamp) {
return <Spinner completed={data.block.isFinal} label={t('Pending...')} />;
if (isPending || !data.block?.timestamp) {
return <Spinner completed={isPending || data.block?.isFinal} label={t('Pending...')} />;
}

return (
Expand Down

0 comments on commit d186ae5

Please sign in to comment.