Skip to content

Commit b512ce0

Browse files
[gdpatchagent] fix(superfluid-campaign-web): throw from switchChainOverride when falling back to AppKit modal
Resolving instead of throwing let callers treat an opened network-selection modal as an already-completed chain switch, since the modal never confirms the switch synchronously. On-Behalf-Of: gdpatchagent[onecli] (yaskkeryodtdijpv)
1 parent e77f788 commit b512ce0

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • apps/superfluid-campaign-web/src

apps/superfluid-campaign-web/src/App.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const DESKTOP_WIDGET_MAX_WIDTH = 960
2121
*/
2222
const APPKIT_DISCONNECT_LABEL = 'Network settings'
2323

24+
const SWITCH_CHAIN_MANUAL_SELECTION_ERROR = 'Select the network in the wallet dialog, then try again.'
25+
2426
function AppKitSuperfluidCampaignWidget() {
2527
const { open } = useAppKit()
2628
const { address, status: accountStatus } = useAppKitAccount()
@@ -76,14 +78,20 @@ function AppKitSuperfluidCampaignWidget() {
7678
// documented recovery path when a target chain has no direct
7779
// programmatic descriptor here, or when switchNetwork itself fails
7880
// (e.g. the connected wallet rejects the automatic switch request).
81+
// The modal only lets the user attempt the switch themselves — it
82+
// never confirms synchronously that one actually happened — so this
83+
// throws rather than resolves, otherwise the caller (core's
84+
// switchChain, and the claim widget's error handling built on top of
85+
// it) would treat an opened modal as an already-finished switch.
7986
if (!targetNetwork) {
8087
await open({ view: 'Networks' })
81-
return
88+
throw new Error(SWITCH_CHAIN_MANUAL_SELECTION_ERROR)
8289
}
8390
try {
8491
await switchNetwork(targetNetwork)
8592
} catch {
8693
await open({ view: 'Networks' })
94+
throw new Error(SWITCH_CHAIN_MANUAL_SELECTION_ERROR)
8795
}
8896
}}
8997
disconnectLabel={APPKIT_DISCONNECT_LABEL}

0 commit comments

Comments
 (0)