-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix issue with manually added networks #22832
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
Conversation
…the network switches to the newly added one but the user is also prompted to switch anyways
|
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. |
| }, | ||
| { | ||
| setActive: true, | ||
| setActive: false, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Builds ready [2c0adcb]
Page Load Metrics (812 ± 24 ms)
Bundle size diffs
|
|
Tested. Great fix! |
davidmurdoch
left a comment
There was a problem hiding this 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 ReportAttention:
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. |
Builds ready [8921af5]
Page Load Metrics (793 ± 34 ms)
Bundle size diffs
|
3c770ff
Builds ready [3c770ff]
Page Load Metrics (810 ± 40 ms)
Bundle size diffs
|
|
Works as expected but will await response to Mark's comments. |
Builds ready [72b5268]
Page Load Metrics (1055 ± 20 ms)
Bundle size diffs
|
| } | ||
|
|
||
| submitCallback?.(); | ||
| if (addNewNetwork && !setActiveOnSubmit) { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
Gudahtt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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
Add Network ManuallyScreenshots/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
Pre-merge reviewer checklist