Skip to content

Commit bf43196

Browse files
authored
[TOOL-3260] SDK: Fix Pay Modal logging react-query error when opened (thirdweb-dev#6104)
1 parent c5d4cab commit bf43196

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.changeset/gentle-dancers-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix thirdweb Pay Modal logging react-query error when opened

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,20 @@ export function TransactionModal(props: ModalProps) {
3737
useQuery({
3838
queryKey: ["transaction-modal-event"],
3939
queryFn: () => {
40-
if (!account || !wallet) return;
40+
if (!account || !wallet) {
41+
throw new Error(); // never happens, because enabled is false
42+
}
4143
trackPayEvent({
4244
client: props.client,
4345
walletAddress: account.address,
4446
walletType: wallet.id,
4547
dstChainId: props.tx.chain.id,
4648
event: "open_pay_transaction_modal",
4749
});
50+
51+
return null;
4852
},
49-
enabled: !!wallet,
53+
enabled: !!wallet && !!account,
5054
});
5155

5256
return (

0 commit comments

Comments
 (0)