Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning on second currentProvider access #138

Merged
merged 1 commit into from
Feb 4, 2021

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Feb 4, 2021

We expose the currentProvider property on our shim as a deprecated way to access to provider, to make the task of migrating dapps away from our injected web3 instance easier. The intent was to warn if that property is used, but log an error to the console and inform MetaMask if any other property is used.

There was a mistake in the logic that caused us to treat subsequent accesses to currentProvider to be treated like some unsupported property was being accessed. This results in the console error being shown erroneously, it bloats our web3 usage metrics, and it causes the warning about web3 usage to appear unnecessarily in the MetaMask UI.

The logic has been updated to never treat currentProvider as an unsupported property. Accessing that property will only result in a deprecation warning.

We expose the `currentProvider` property on our shim as a deprecated
way to access to provider, to make the task of migrating dapps away
from our injected web3 instance easier. The intent was to warn if that
property is used, but log an error to the console and inform MetaMask
if any other property is used.

There was a mistake in the logic that caused us to treat subsequent
accesses to `currentProvider` to be treated like some unsupported
property was being accessed. This results in the console error being
shown erroneously, it bloats our web3 usage metrics, and it causes the
warning about web3 usage to appear unnecessarily in the MetaMask UI.

The logic has been updated to never treat `currentProvider` as an
unsupported property. Accessing that property will only result in a
deprecation warning.
@Gudahtt Gudahtt requested a review from a team as a code owner February 4, 2021 13:46
@Gudahtt
Copy link
Member Author

Gudahtt commented Feb 4, 2021

This was reported here: MetaMask/metamask-extension#10356

@Gudahtt Gudahtt requested a review from rekmarks February 4, 2021 13:47
Copy link
Member

@kumavis kumavis left a comment

Choose a reason for hiding this comment

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

LQQKS GQQD

@Gudahtt Gudahtt merged commit 1bab224 into main Feb 4, 2021
@Gudahtt Gudahtt deleted the fix-web3-warning-on-second-currentProvider-access branch February 4, 2021 14:47
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.

2 participants