Skip to content

Commit

Permalink
cherrypick: #6664 (#6693)
Browse files Browse the repository at this point in the history
bugfix: close completeExchange drawer when sell or card (#6664)

* bugfix: close completeExchange drawer when sell or card

* chore: changeset

* chore: fix ci
  • Loading branch information
CremaFR authored Apr 16, 2024
1 parent 50ad786 commit ba007c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-windows-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ledger-live-desktop": patch
---

bugfix: close exchangeComplete for card sell
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const Body = ({ data, onClose }: { data: Data; onClose?: () => void | undefined

const onBroadcastSuccess = useCallback(
(operation: Operation) => {
// Save swap history
// If swap we save to swap history and keep open the drawer
if (swapId && toAccount && magnitudeAwareRate && sourceCurrency && targetCurrency) {
const newResult = {
operation,
Expand All @@ -152,13 +152,18 @@ const Body = ({ data, onClose }: { data: Data; onClose?: () => void | undefined
if (getEnv("DISABLE_TRANSACTION_BROADCAST")) {
return onCancel(new DisabledTransactionBroadcastError());
}
onResult(operation);
// else not swap i.e card and sell we close the drawer
} else {
onResult(operation);
onClose?.();
}
onResult(operation);
},
[
setResult,
onResult,
onCancel,
onClose,
updateAccount,
magnitudeAwareRate,
provider,
Expand Down

0 comments on commit ba007c4

Please sign in to comment.