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

refactor: the network name and image utils into selectors #9638

Closed
wants to merge 29 commits into from

Conversation

EtherWizard33
Copy link
Contributor

@EtherWizard33 EtherWizard33 commented May 15, 2024

Description

We are replacing calls to the get network name and get network image from utils to use a selector instead.

This way all places referring to it will do so in the same way and all with the same memoization provided by reselect.

Related issues

Fixes:

Manual testing steps

  1. Where the network name and image were used before, the network name and image should still display after, there are about 15 places for each.
  2. Mostly used for the network logos and it's network name used as a fallback letter
  3. Other use cases are plainly to display the network name as text

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

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.

@EtherWizard33 EtherWizard33 changed the title Refactor the network name util into a selector refactor: the network name util into a selector May 15, 2024
@EtherWizard33 EtherWizard33 marked this pull request as ready for review May 15, 2024 20:13
@EtherWizard33 EtherWizard33 requested review from a team as code owners May 15, 2024 20:13
refactor: use new selector instead of utils to get the networkImageSource
@EtherWizard33 EtherWizard33 requested a review from a team as a code owner May 15, 2024 23:46
@EtherWizard33 EtherWizard33 changed the title refactor: the network name util into a selector refactor: the network name and image utils into a selector May 15, 2024
@EtherWizard33 EtherWizard33 changed the title refactor: the network name and image utils into a selector refactor: the network name and image utils into selectors May 16, 2024
Copy link
Contributor

@tommasini tommasini left a comment

Choose a reason for hiding this comment

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

After addressing the conversations and the unit test failure.

Could you record a video of the app-impacted screens?

@darkwing darkwing added the needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. label May 17, 2024
@EtherWizard33 EtherWizard33 requested a review from a team as a code owner May 17, 2024 17:31
Copy link

socket-security bot commented May 17, 2024

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

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] None +11 1.43 MB metamaskbot
npm/@metamask/[email protected] Transitive: environment, network +18 1.63 MB metamaskbot
npm/@metamask/[email protected] environment Transitive: network +8 1.18 MB metamaskbot
npm/@metamask/[email protected] Transitive: network +9 1 MB metamaskbot
npm/@metamask/[email protected] None +6 301 kB metamaskbot
npm/@metamask/[email protected] None 0 30.1 kB metamaskbot
npm/@reduxjs/[email protected] environment +1 13.1 MB acemarke
npm/[email protected] None 0 285 kB isaacs
npm/[email protected] Transitive: environment, eval, filesystem, network, shell, unsafe +244 366 MB kudochien
npm/[email protected] environment +2 318 kB acemarke
npm/[email protected] None 0 14.7 kB robwalkerco
npm/[email protected] Transitive: environment +9 735 kB redux-saga-release-bot
npm/[email protected] environment 0 169 kB timdorr
npm/[email protected] network Transitive: filesystem +2 3.05 MB traviskn

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

View full report↗︎

Copy link

socket-security bot commented May 17, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSource
New author npm/@jest/[email protected]
New author npm/[email protected]
New author npm/[email protected]
New author npm/@metamask/[email protected]
Network access npm/[email protected]
New author npm/[email protected]
New author npm/@react-native-community/[email protected]
New author npm/@react-native-community/[email protected]

View full report↗︎

Next steps

What is new author?

A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.

Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

Copy link

sonarcloud bot commented May 17, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
33.2% Coverage on New Code (required ≥ 40%)

See analysis details on SonarCloud

Copy link
Contributor

@brianacnguyen brianacnguyen left a comment

Choose a reason for hiding this comment

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

why are we removing the close option in toast?

@EtherWizard33
Copy link
Contributor Author

why are we removing the close option in toast?

Hi Brian, this PR got merged with too much content which included stuff about the close option which is not part of this PR.
I actually had to recreated a new PR which is just about selectors, and no UI, closing this one.

@github-actions github-actions bot locked and limited conversation to collaborators May 21, 2024
@EtherWizard33 EtherWizard33 deleted the refactor/network-name-util-into-a-selector branch May 30, 2024 17:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. team-wallet-ux
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants