Skip to content

Conversation

@adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Feb 6, 2024

Fixes issue where after manually adding a network via the network form the network switches to the newly added one but the user is also prompted to switch anyways. As is the case with adding one of the "supported" networks, the expected UX is that the network does not automatically switch but the user sees a modal after adding the network with the option to switch.

Manual testing steps

  1. Go to Add Network in Network Selector
  2. Scroll to the bottom and click Add Network Manually
  3. Add any network via the network form
  4. See that the globally selected network does not automatically switch but that a modal pops with an option to switch
  5. Click the switch option and see that the globally selected network switches as expected.

Screenshots/Recordings

Before

Screen.Recording.2024-02-06.at.2.24.46.PM.mov

(Before) Adding a network in the onboarding flow:

Screen.Recording.2024-02-06.at.8.08.56.PM.mov

After

Screen.Recording.2024-02-06.at.2.26.41.PM.mov

(After) adding a network in the onboarding flow:

Screen.Recording.2024-02-06.at.6.07.13.PM.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • 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.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

…the network switches to the newly added one but the user is also prompted to switch anyways
@adonesky1 adonesky1 requested a review from a team as a code owner February 6, 2024 20:23
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2024

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.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Feb 6, 2024
@adonesky1 adonesky1 added team-extension-ux team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels Feb 6, 2024
},
{
setActive: true,
setActive: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line could also just be removed since the default value for this argument is false.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems no other caller of upsertNetworkConfiguration tries to override setActive. Let's just remove this and rely on the default

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Feb 6, 2024
@adonesky1 adonesky1 mentioned this pull request Feb 6, 2024
13 tasks
@metamaskbot
Copy link
Collaborator

Builds ready [2c0adcb]
Page Load Metrics (812 ± 24 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint82151107178
domContentLoaded105220105
load7129078125124
domInteractive105220105
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@jiexi
Copy link
Contributor

jiexi commented Feb 6, 2024

Tested. Great fix!

davidmurdoch
davidmurdoch previously approved these changes Feb 6, 2024
Copy link
Contributor

@davidmurdoch davidmurdoch left a comment

Choose a reason for hiding this comment

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

I've always expected the save button to take me back to the settings page, not the main page. This PR definitely improves the current flow, and is likely what was originally intended, so it's a win even if its not what I expect the behavior to be.

@codecov
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (dc312cd) 68.47% compared to head (72b5268) 68.47%.
Report is 1 commits behind head on develop.

Files Patch % Lines
...ttings/networks-tab/networks-form/networks-form.js 25.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #22832   +/-   ##
========================================
  Coverage    68.47%   68.47%           
========================================
  Files         1088     1088           
  Lines        42956    42957    +1     
  Branches     11437    11438    +1     
========================================
+ Hits         29410    29411    +1     
  Misses       13546    13546           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [8921af5]
Page Load Metrics (793 ± 34 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint82137102147
domContentLoaded10331753
load7059767937134
domInteractive10331753
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 67 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

tmashuang
tmashuang previously approved these changes Feb 6, 2024
@adonesky1 adonesky1 requested a review from Gudahtt February 7, 2024 16:01
@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 Feb 7, 2024
davidmurdoch
davidmurdoch previously approved these changes Feb 7, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [3c770ff]
Page Load Metrics (810 ± 40 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint801611082110
domContentLoaded9551894
load73810748108440
domInteractive9551894
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 69 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

tmashuang
tmashuang previously approved these changes Feb 8, 2024
@darkwing
Copy link
Contributor

darkwing commented Feb 9, 2024

Works as expected but will await response to Mark's comments.

@metamaskbot
Copy link
Collaborator

Builds ready [72b5268]
Page Load Metrics (1055 ± 20 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1322692013215
domContentLoaded1268422210
load971111410554120
domInteractive1168422210
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 84 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

}

submitCallback?.();
if (addNewNetwork && !setActiveOnSubmit) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If setActiveOnSubmit is true we switch to the network immediately so we should not show a modal prompting the user to switch to the newly added network (as happens when setNewNetworkAdded action is called.

);

trackEvent({
event: MetaMetricsEventName.CustomNetworkAdded,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This event is only called now when a network is added, not when an existing network is edited.

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@adonesky1 adonesky1 merged commit 14d1974 into develop Feb 13, 2024
@adonesky1 adonesky1 deleted the ad/fix-manual-network-add branch February 13, 2024 21:03
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2024
@metamaskbot metamaskbot added the release-11.12.0 Issue or pull request that will be included in release 11.12.0 label Feb 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. release-11.12.0 Issue or pull request that will be included in release 11.12.0 team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants