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: handle overlapping add network requests #7276

Merged
merged 4 commits into from
Sep 21, 2023

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Sep 20, 2023

Description

When adding a network, an approval flow is used to ensure the modal remains visible while showing both the add network and switch network confirmations.

Currently if two add network approval requests exist at the same time, the first is rejected by the second however this leaves the associated approval flow of the first open as it cannot be ended since it is a parent to the second approval flow. This results in the first approval flow persisting until restart causing an infinite loader to be shown.

This PR resolves this scenario by clearing all pending approval requests before creating the approval flow which in turn ends their associated approval flows.

Manual Testing Steps

  1. Go to chainlist.network.
  2. Double click when adding any new network.
  3. Approve the add network confirmation.
  4. Approve the switch network confirmation.
  5. Ensure no infinite loader or confirmation is visible.

Recordings

add_network_overlap.mov

Related Issues

Fixes #7259

Pre-merge Author Checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained:
    • What problem this PR is solving.
    • How this problem was solved.
    • How reviewers can test my changes.
  • I’ve indicated what issue this PR is linked to: Fixes #???
  • I’ve included tests if applicable.
  • I’ve documented any added code.
  • I’ve applied the right labels on the PR (see labeling guidelines).
  • 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.

@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner September 20, 2023 11:03
@github-actions
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.

@matthewwalsh0 matthewwalsh0 changed the title fix: handle duplicate add network requests fix: handle overlapping add network requests Sep 20, 2023
@matthewwalsh0 matthewwalsh0 added the team-confirmations-system DEPRECATED: please use "team-confirmations" label instead label Sep 20, 2023
OGPoyraz
OGPoyraz previously approved these changes Sep 20, 2023
vinistevam
vinistevam previously approved these changes Sep 20, 2023
@sonarcloud
Copy link

sonarcloud bot commented Sep 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@sleepytanya
Copy link
Contributor

Works as expected:

Screen.Recording.2023-09-20.at.12.28.25.PM.mov

@matthewwalsh0 matthewwalsh0 added the QA Passed A successful QA run through has been done label Sep 21, 2023
@matthewwalsh0
Copy link
Member Author

Bitrise Report

@matthewwalsh0 matthewwalsh0 merged commit ad9793b into main Sep 21, 2023
25 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/7259-add-network-infinite-loader branch September 21, 2023 08:52
@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
QA Passed A successful QA run through has been done release-7.9.0 team-confirmations-system DEPRECATED: please use "team-confirmations" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Endless loading after adding and then switching to newly added network
5 participants