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

chore: Remove toggle to turn on/off Per Dapp Selected Network Feature #28577

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Nov 20, 2024

Description

The "Select networks for each site" preference toggle on the experimental settings page has been live for many releases now since the toggle has been turned on by default. We meant to remove it a while ago.

Screenshot 2024-11-19 at 10 58 04 AM

This PR removes this toggle and integrates new versions of the QueuedRequestController and SelectedNetworkController which remove the backend logic it operated.

Beyond the fact that this removal is overdue, another reason we should remove this now is that having this setting when turned off is causing a bug with wallet_switchEthereumChain and the interaction with the new chain permissions feature.

References

core side changes: MetaMask/core#4941

#28441

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@adonesky1 adonesky1 changed the title Ad/remove per dapp selected network preference toggle chore: remove per dapp selected network preference toggle Nov 20, 2024
Copy link

socket-security bot commented Nov 20, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] None 0 168 kB metamaskbot
npm/@metamask/[email protected] None 0 121 kB metamaskbot

🚮 Removed packages: npm/@metamask/[email protected], npm/@metamask/[email protected]

View full report↗︎

@adonesky1 adonesky1 changed the title chore: remove per dapp selected network preference toggle chore: Remove toggle to turn on/off Per Dapp Selected Network Feature Nov 20, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Nov 20, 2024
@adonesky1 adonesky1 force-pushed the ad/remove-per-dapp-selected-network-preference-toggle branch from b23245a to 8d37a93 Compare November 20, 2024 22:24
adonesky1 added a commit to MetaMask/core that referenced this pull request Nov 22, 2024
…ed Network Feature (#4941)

## Explanation

The "Select networks for each site" preference toggle on the
experimental settings page has been live for many releases now since the
toggle has been turned on by default. We meant to remove it a while ago.

<img width="770" alt="Screenshot 2024-11-19 at 10 58 04 AM"
src="https://github.com/user-attachments/assets/aeca2483-c019-4f9f-b44e-520d10db9eee">

This PR removes the togglability of per dapp selected network from the
`SelectedNetworkController` and `QueuedRequestMiddleware`

The extension to integrate this change will also have to implement a
migration to remove this state.

Another reason we should remove this now is that having this setting
turned off is [causing a
bug](MetaMask/metamask-extension#28441) to
result with `wallet_switchEthereumChain` and the interaction between the
new chain permissions feature and the absence of queuing.

## References

Extension PR w/ preview builds of this PR (plus full removal of the
toggle): MetaMask/metamask-extension#28577

When integrated in the extension will resolve this issue:
MetaMask/metamask-extension#28441

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/queued-request-controller`

- **REMOVED**: `createQueuedRequestMiddleware` no longer expects a
`useRequestQueue` property in its param options.


### `@metamask/selected-network-controller`

- **REMOVED**: SelectedNetworkController constructure no longer expects
either `useRequestQueuePreference` or `onPreferencesStateChange` params

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
isObject(state.PreferencesController) &&
hasProperty(state.PreferencesController, 'preferences') &&
isObject(state.PreferencesController.preferences) &&
hasProperty(state.PreferencesController.preferences, 'useRequestQueue')
Copy link
Contributor

Choose a reason for hiding this comment

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

probably can delete without checking if it exists. doesn't really matter either way though

@jiexi
Copy link
Contributor

jiexi commented Nov 22, 2024

beautiful! just needs the core release cut and usage here

@adonesky1 adonesky1 force-pushed the ad/remove-per-dapp-selected-network-preference-toggle branch from f94712a to dc9ae6e Compare November 26, 2024 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template team-wallet-api-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants