Skip to content

Conversation

@jaffarkeikei
Copy link

Summary

Fixes #2596

The AutoConnect component was only attempting to connect once due to the hasAttemptedConnection ref never being reset. After a user disconnects in Base App, the ref would remain true, preventing auto-connect from running again — causing the Connect button to do nothing.

The Problem

// This ref is set to true on first connect attempt and never reset
hasAttemptedConnection.current = true;

After disconnect:

  1. User taps Connect
  2. hasAttemptedConnection.current is still true
  3. Early return prevents auto-connect
  4. Connect button appears to do nothing

The Fix

Reset hasAttemptedConnection when the user disconnects:

useEffect(() => {
  if (!isConnected && !isConnecting) {
    hasAttemptedConnection.current = false;
  }
}, [isConnected, isConnecting]);

Testing

Added test case: "should attempt reconnection after disconnect" that verifies:

  1. Initial auto-connect works
  2. After simulating connect → disconnect cycle
  3. Auto-connect runs again (connect called twice total)

The AutoConnect component was only attempting to connect once due to the
hasAttemptedConnection ref never being reset. After a user disconnects,
the ref would remain true, preventing auto-connect from running again.

This fix resets hasAttemptedConnection when the user disconnects (when
isConnected and isConnecting are both false), allowing auto-connect to
work properly after a disconnect in Base App.

Fixes coinbase#2596
@cb-heimdall
Copy link

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@vercel
Copy link

vercel bot commented Jan 27, 2026

@jaffarkeikei is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@0xsarawut 0xsarawut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0xsarawut.base.eth

@cb-heimdall
Copy link

Review Error for 0xsarawut @ 2026-01-27 21:04:28 UTC
User failed mfa authentication, either user does not exist or public email is not set on your github profile. \ see go/mfa-help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

MiniKit reconnect fails after disconnect in Base App

3 participants