Skip to content

Conversation

@dima74
Copy link

@dima74 dima74 commented Dec 19, 2025

Description

Currently walletProvider is wrapped with ref in useAppKitProvider. This creates Proxy for walletProvider, which could result in error like this on some wallets (e.g. MetaMask + Solana) when passing resulting walletProvider as argument to AnchorProvider (solana primary framework):

index-CCid8-zN.js:17 TypeError: Cannot read private member from an object whose class did not declare it
at G (inpage.js:2:131052)
at get accounts (inpage.js:2:255980)
at Reflect.get (<anonymous>)
at MutableReactiveHandler.get (index-CCid8-zN.js:10:11881)
at Proxy.getAccount (index-CCid8-zN.js:1032:4974)
at get publicKey (index-CCid8-zN.js:1032:2238)
at Reflect.get (<anonymous>)
at MutableReactiveHandler.get (index-CCid8-zN.js:10:11881)
at new AnchorProvider (index-CCid8-zN.js:1033:1295)
...

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)

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

Copilot AI review requested due to automatic review settings December 19, 2025 19:33
@changeset-bot
Copy link

changeset-bot bot commented Dec 19, 2025

⚠️ No Changeset found

Latest commit: 9c790cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Dec 19, 2025

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

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 19, 2025

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

@dima74
Copy link
Author

dima74 commented Dec 19, 2025

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in the Vue implementation where wrapping walletProvider with Vue's ref created deep reactive Proxies that caused errors with certain wallets (e.g., MetaMask + Solana) when interfacing with the Solana Anchor framework.

  • Changed ref to shallowRef for provider objects to prevent deep reactivity
  • Maintained reactivity for subscription updates while avoiding Proxy-related errors

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +66 to +67
const walletProvider = shallowRef(ProviderController.state.providers[chainNamespace] as T | undefined)
const walletProviderType = shallowRef(ProviderController.state.providerIds[chainNamespace])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you describe a case where ref caused an issue/problem just so i can reproduce the issue on my end?

Copy link
Author

Choose a reason for hiding this comment

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

Created demo: https://stackblitz.com/edit/github-j6in4egw?file=src%2Fcomponents%2Fdemo.ts

Open the project, connect metamask, observe TypeError: Cannot read private member from an object whose class did not declare it exception in browser logs

@glitch-txs
Copy link
Contributor

glitch-txs commented Dec 31, 2025

this is most probably because Anchor is expecting a different interface, you will probably need to build an adapter

@dima74
Copy link
Author

dima74 commented Dec 31, 2025

this is most probably because Anchor is expecting a different interface, you will probably need to build an adapter

Problem is with ref/reactive wrapping. Without wrapping (e.g. using shallowRef as proposed in this PR), there will be no error and everything will work correctly.

@glitch-txs
Copy link
Contributor

glitch-txs commented Jan 1, 2026

have you tried using binding then?

@dima74
Copy link
Author

dima74 commented Jan 1, 2026

have you tried using binding then?

Sorry what binding do you mean?

@glitch-txs
Copy link
Contributor

how do you know it's a ref issue?

the Anchor class requires a Wallet Standard wallet, walletProvider is a completely custom class built by AppKit internally

@dima74
Copy link
Author

dima74 commented Jan 1, 2026

how do you know it's a ref issue?

There will be no error and everything will work correctly without ref/reactive wrapping (e.g. using shallowRef as proposed in this PR)

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.

3 participants