Skip to content

Commit a83104e

Browse files
committed
[MNY-200] SDK: Fix onSuccess callback not called when tx is sent in TransactionWidget (#8119)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR simplifies the `handlePostBuyTransactionComplete` function in the `BridgeOrchestrator` component by removing the `quote` parameter and the associated call to `onComplete`. It streamlines the transaction completion process and adjusts the `closeModal` prop accordingly. ### Detailed summary - Removed the `quote` parameter from the `handlePostBuyTransactionComplete` function. - Eliminated the call to `onComplete?.(quote)` within the `handlePostBuyTransactionComplete` function. - Updated the `closeModal` prop in the `ExecutingTxScreen` component to directly use `handlePostBuyTransactionComplete` without arguments. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 7936ebb commit a83104e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,9 @@ export function BridgeOrchestrator({
189189
}, [send, uiOptions.mode]);
190190

191191
// Handle post-buy transaction completion
192-
const handlePostBuyTransactionComplete = useCallback(
193-
(quote: BridgePrepareResult) => {
194-
onComplete?.(quote);
195-
send({ type: "RESET" });
196-
},
197-
[onComplete, send],
198-
);
192+
const handlePostBuyTransactionComplete = useCallback(() => {
193+
send({ type: "RESET" });
194+
}, [send]);
199195

200196
// Handle errors
201197
const handleError = useCallback(
@@ -416,9 +412,9 @@ export function BridgeOrchestrator({
416412
quote &&
417413
uiOptions.transaction && (
418414
<ExecutingTxScreen
419-
closeModal={() => handlePostBuyTransactionComplete(quote)}
415+
closeModal={handlePostBuyTransactionComplete}
420416
onTxSent={() => {
421-
// Do nothing
417+
onComplete?.(quote);
422418
}}
423419
tx={uiOptions.transaction}
424420
windowAdapter={webWindowAdapter}

0 commit comments

Comments
 (0)