Skip to content

fix(ethers,ethers5): restore Coinbase Wallet / Base Account session on page reload - #5750

Open
kamal9494 wants to merge 1 commit into
reown-com:mainfrom
kamal9494:fix/ethers-coinbase-reconnect-on-reload
Open

fix(ethers,ethers5): restore Coinbase Wallet / Base Account session on page reload#5750
kamal9494 wants to merge 1 commit into
reown-com:mainfrom
kamal9494:fix/ethers-coinbase-reconnect-on-reload

Conversation

@kamal9494

Copy link
Copy Markdown

Description

Fixes Coinbase Smart Wallet / Base Account sessions being dropped on page reload with the ethers and ethers5 adapters.

Root cause

Regression from #5336 (lazy load coinbase, shipped in 1.8.15).

  • createEthersConfig() creates CoinbaseWalletProvider and BaseProvider but intentionally does not call initialize(), so the SDK is only loaded when needed.
  • syncConnectors() then registers each connector with provider: await provider.getProvider(), which is undefined for those two because nothing has built the SDK yet.
  • connect() was updated to call initialize() before use, so the first connection works.
  • The reload path was not. On page load the core calls syncConnection(), which reads connector.provider directly:
const selectedProvider = connector?.provider as Provider // undefined for coinbaseWallet / baseAccount

if (!selectedProvider) {
  throw new Error('Provider not found')
}
  • The core catches that error and calls onDisconnectNamespace(), so the user is silently logged out. The SDK is never created on that page load.

Fix

Keep the lazy load, but treat a returning user as the one exception. In createEthersConfig(), right where each lazy provider is created:

this.ethersProviders.coinbaseWallet = new CoinbaseWalletProvider()
if (this.hasStoredConnection(CommonConstantsUtil.CONNECTOR_ID.COINBASE)) {
  await this.ethersProviders.coinbaseWallet.initialize()
}

hasStoredConnection() is a small private helper around HelpersUtil.getConnectorStorageInfo(), the same check syncConnections() already uses (hasConnected && !hasDisconnected).

Tests

Four cases added to the existing createEthersConfig suite in each adapter:

  • previously connected with coinbase: coinbaseWallet.initialize() called once, base not touched
  • previously connected with base account: the mirror
  • never connected: neither initialized
  • explicitly disconnected: neither initialized

The first two fail on the current main and pass with this change.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

closes #5749

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 81cbc44

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-tron Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-utils Patch
@reown/appkit-cdn Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch
@reown/appkit-common Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-experimental Patch
@reown/appkit-pay Patch
@reown/appkit-polyfills Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-testing Patch
@reown/appkit-ui Patch
@reown/appkit-universal-connector Patch
@reown/appkit-wallet Patch
@reown/appkit-wallet-button Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

@kamal9494 is attempting to deploy a commit to the Reown Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@kamal9494

Copy link
Copy Markdown
Author

I have read the CTA Document and I hereby sign the CTA

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] ethers/ethers5: Coinbase Smart Wallet and Base Account disconnect on page refresh (wagmi is fine)

1 participant