Skip to content

Commit f127e76

Browse files
committed
frontend: discard tx details result if internalID changed.
1 parent 0b6f9cd commit f127e76

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

frontends/web/src/components/transactions/details.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ export const TransactionDetails = ({
5151
if (!internalID) {
5252
return;
5353
}
54+
const currentID = internalID;
5455
getTransaction(accountCode, internalID)
5556
.then(transaction => {
57+
if (internalID !== currentID) {
58+
return; // Ignore if internalID has changed since the request was made.
59+
}
5660
if (!transaction) {
5761
console.error(`Unable to retrieve transaction ${internalID}`);
5862
return;
@@ -68,11 +72,8 @@ export const TransactionDetails = ({
6872
}, [fetchTransaction]);
6973

7074
useEffect(() => {
71-
if (!internalID) {
72-
return;
73-
}
74-
return syncdone(accountCode, fetchTransaction)
75-
}, [accountCode, internalID, fetchTransaction]);
75+
return syncdone(accountCode, fetchTransaction);
76+
}, [accountCode, fetchTransaction]);
7677

7778
if (!transactionInfo) {
7879
return null;

0 commit comments

Comments
 (0)