Skip to content

fix: token list cleared on network switch#24212

Merged
bergeron merged 6 commits intodevelopfrom
brian/tokenlist-polling-network-switch
Apr 24, 2024
Merged

fix: token list cleared on network switch#24212
bergeron merged 6 commits intodevelopfrom
brian/tokenlist-polling-network-switch

Conversation

@bergeron
Copy link
Copy Markdown
Contributor

@bergeron bergeron commented Apr 24, 2024

Description

Problem: When switching networks, the token list is cleared. Preventing token import via search or autodetect.

Diagnosis: TokenListController.preventPollingOnNetworkRestart was true, which intentionally clears the token list on network switch. Prior to #23919, this setting would be set false when enabling token autodetection. But this code path no longer triggers.

Solution: Set the initial value of preventPollingOnNetworkRestart based on whether we need token lists.

Open in GitHub Codespaces

Related issues

Manual testing steps

  1. Open MetaMask
  2. Enable token autodetection in settings.
  3. Switch networks
  4. Tokens should be autodetected
  5. Click import tokens
  6. The left search tab should autocomplete when you type token names

Screenshots/Recordings

Before

Screenshot 2024-04-23 at 11 08 47 PM

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.

@bergeron bergeron requested a review from a team as a code owner April 24, 2024 06:18
@github-actions
Copy link
Copy Markdown
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.

@bergeron bergeron added the needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. label Apr 24, 2024
@bergeron bergeron force-pushed the brian/tokenlist-polling-network-switch branch from 83d6cb1 to 107e8f0 Compare April 24, 2024 06:31
@bergeron bergeron merged commit fb49066 into develop Apr 24, 2024
@bergeron bergeron deleted the brian/tokenlist-polling-network-switch branch April 24, 2024 17:30
@github-actions github-actions bot locked and limited conversation to collaborators Apr 24, 2024
@metamaskbot metamaskbot added the release-11.16.0 Issue or pull request that will be included in release 11.16.0 label Apr 24, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [61c6680]
Page Load Metrics (1141 ± 630 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint662131104120
domContentLoaded10101272110
load52302411411313630
domInteractive10101272110
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -12 Bytes (-0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot metamaskbot added release-11.15.0 Issue or pull request that will be included in release 11.15.0 and removed release-11.16.0 Issue or pull request that will be included in release 11.16.0 labels Apr 25, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Missing release label release-11.15.0 on PR. Adding release label release-11.15.0 on PR and removing other release labels(release-11.16.0), as PR was cherry-picked in branch 11.15.0.

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. release-11.15.0 Issue or pull request that will be included in release 11.15.0 team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants