Skip to content

Commit 43f430c

Browse files
fix: clear synchronous quote handoff
1 parent f29e5ae commit 43f430c

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

app/components/Views/confirmations/components/info/custom-amount-info/custom-amount-info.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,22 @@ describe('CustomAmountInfo', () => {
12791279
view.rerender(createCustomAmountInfo());
12801280
}
12811281

1282+
it('clears the handoff for synchronous updates without quote signals', async () => {
1283+
const view = render();
1284+
1285+
await act(async () => {
1286+
fireEvent.press(view.getByText(strings('confirm.edit_amount_done')));
1287+
});
1288+
await act(async () => {
1289+
await new Promise<void>((resolve) => setTimeout(resolve, 0));
1290+
});
1291+
1292+
expect(view.getByTestId('bridge-fee-row')).toBeOnTheScreen();
1293+
expect(
1294+
view.getByTestId(ConfirmationFooterSelectorIDs.CONFIRM_BUTTON),
1295+
).not.toBeDisabled();
1296+
});
1297+
12821298
it('shows fee rows for same-chain payment without quotes', async () => {
12831299
useTransactionPayHasSourceAmountMock.mockReturnValue(false);
12841300
useTransactionPayQuotesMock.mockReturnValue([]);

app/components/Views/confirmations/components/info/custom-amount-info/custom-amount-info.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,19 @@ export const CustomAmountInfo: React.FC<CustomAmountInfoProps> = memo(
328328
) {
329329
setIsAmountUpdateComplete(false);
330330
setIsAmountUpdating(false);
331+
return;
332+
}
333+
334+
if (!isAmountUpdateComplete) {
335+
return;
331336
}
337+
338+
const handoffTimeout = setTimeout(() => {
339+
setIsAmountUpdateComplete(false);
340+
setIsAmountUpdating(false);
341+
}, 0);
342+
343+
return () => clearTimeout(handoffTimeout);
332344
}, [isAmountUpdateComplete, isQuotesLoading, quotesLastUpdated]);
333345

334346
const wasPrefillPending = useRef(isPrefillPending);

0 commit comments

Comments
 (0)