fix(ethers,ethers5): restore Coinbase Wallet / Base Account session on page reload - #5750
Open
kamal9494 wants to merge 1 commit into
Open
fix(ethers,ethers5): restore Coinbase Wallet / Base Account session on page reload#5750kamal9494 wants to merge 1 commit into
kamal9494 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 81cbc44 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
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 |
|
@kamal9494 is attempting to deploy a commit to the Reown Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
All contributors have signed the CTA ✍️ ✅ |
Author
|
I have read the CTA Document and I hereby sign the CTA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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()createsCoinbaseWalletProviderandBaseProviderbut intentionally does not callinitialize(), so the SDK is only loaded when needed.syncConnectors()then registers each connector withprovider: await provider.getProvider(), which isundefinedfor those two because nothing has built the SDK yet.connect()was updated to callinitialize()before use, so the first connection works.syncConnection(), which readsconnector.providerdirectly: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:hasStoredConnection()is a small private helper aroundHelpersUtil.getConnectorStorageInfo(), the same checksyncConnections()already uses (hasConnected && !hasDisconnected).Tests
Four cases added to the existing
createEthersConfigsuite in each adapter:coinbaseWallet.initialize()called once, base not touchedThe first two fail on the current
mainand pass with this change.Type of change
Associated Issues
closes #5749
Checklist