Skip to content

Commit e911a66

Browse files
committed
[MNY-232] SDK: Fix ExecutingTxScreen missing back button in TransactionWidget (#8193)
<!-- ## 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 focuses on enhancing the transaction handling in the `TransactionWidget` and `TransactionModal` components by ensuring that the `onBack` function is defined and properly utilized. ### Detailed summary - In `TransactionWidget.tsx`, added `onBack` function to `ExecutingTxScreen` that sets the screen to `init-ui`. - In `TransactionModal.tsx`, modified `onBack` to set the screen to `"deposit"`. - In `ExecutingScreen.tsx`, changed `onBack` from optional to required. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 86461f9 commit e911a66

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,9 @@ function TransactionWidgetContent(
770770
if (screen.id === "execute-tx") {
771771
return (
772772
<ExecutingTxScreen
773+
onBack={() => {
774+
setScreen({ id: "init-ui" });
775+
}}
773776
closeModal={() => {
774777
setScreen({ id: "init-ui" });
775778
}}

packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function ExecutingTxScreen(props: {
2020
tx: PreparedTransaction;
2121
closeModal: () => void;
2222
onTxSent: (data: WaitForReceiptOptions) => void;
23-
onBack?: () => void;
23+
onBack: (() => void) | undefined;
2424
windowAdapter: WindowAdapter;
2525
}) {
2626
const sendTxCore = useSendTransaction({

packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ function DepositAndExecuteTx(props: ModalProps) {
133133
if (screen === "execute-tx") {
134134
return (
135135
<ExecutingTxScreen
136+
onBack={() => {
137+
setScreen("deposit");
138+
}}
136139
closeModal={props.onClose}
137140
onTxSent={props.onTxSent}
138141
tx={props.tx}

0 commit comments

Comments
 (0)