You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/core/SDKConnectV2/services/connection-registry.ts
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -247,6 +247,7 @@ export class ConnectionRegistry {
247
247
letconn: Connection|undefined;
248
248
letconnInfo: ConnectionInfo|undefined;
249
249
letconnReq: ConnectionRequest|undefined;
250
+
letdidConnectionFail=false;
250
251
251
252
try{
252
253
connReq=this.parseConnectionRequest(url);
@@ -297,6 +298,7 @@ export class ConnectionRegistry {
297
298
}catch(error){
298
299
logger.error('Failed to handle connect deeplink:',error,redactUrl(url));
299
300
this.hostapp.showConnectionError();
301
+
didConnectionFail=true;
300
302
301
303
// Track the failure before cleanup so the event fires even if
302
304
// disconnect() throws.
@@ -315,13 +317,22 @@ export class ConnectionRegistry {
315
317
316
318
if(conn)awaitthis.disconnect(conn.id);
317
319
}finally{
318
-
// For direct deeplink flows from native browser / react native, the connection request will have an initial message in the session request.
319
-
// This means an approval will be shown to the user soon after the MWP handshake is complete, so we can safely dismiss the loading toast.
320
-
// For QR flow, the connection request will not have an initial message in the session request because the dapp is expected to send it separately after the MWP handshake is complete.
321
-
// Because there may be a longer delay until the wallet receives the initial message from the dapp directly, we should not dismiss the loading toast immediately after the MWP handshake is complete.
322
-
320
+
// Loading-toast dismissal rules:
321
+
// - On failure, always dismiss the loading toast. Otherwise the user
322
+
// would briefly see both a "loading" toast and the error toast at
323
+
// the same time, and the loading toast would linger after the error
324
+
// toast auto-dismisses.
325
+
// - On success for direct deeplink flows (initialMessage present), the
326
+
// connection request includes the initial RPC, so an approval will
327
+
// surface immediately after the MWP handshake — it's safe to dismiss
328
+
// the loading toast right away.
329
+
// - On success for QR flows (no initialMessage), the dapp sends
330
+
// wallet_createSession separately after the handshake. There may be
331
+
// a noticeable delay before the approval appears, so we keep the
332
+
// loading toast visible and let it autodismiss naturally.
0 commit comments