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: fix token detection modal stuck on firefox #25279

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

sahar-fehri
Copy link
Contributor

@sahar-fehri sahar-fehri commented Jun 12, 2024

Description

Token detection modal seems to stay stuck on firefox

Open in GitHub Codespaces

Related issues

Fixes: #25256

Manual testing steps

To run locally use:
rm -rf dist && ENABLE_MV3=false yarn && ENABLE_MV3=false yarn build:dev dev --build-type main --lockdown false --snow false --apply-lavamoat false

  1. Import wallet on firefox
  2. Got to settings => security and privacy and disable token auto detection
  3. Go back to home page and you should see the token detection modal
  4. Clicking on allow should dismiss the modal and enable the token detection

Screenshots/Recordings

Before

Screen.Recording.2024-06-13.at.00.14.55.mov

After

Screen.Recording.2024-06-13.at.00.05.54.mov

Pre-merge author checklist

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.

@sahar-fehri sahar-fehri requested a review from a team as a code owner June 12, 2024 22:10
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.

@@ -55,7 +54,6 @@ function AutoDetectTokenModal({
category: MetaMetricsEventCategory.Navigation,
properties: {
chain_id: chainId,
locale: getCurrentLocale,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @salimtb 👋 any idea why this was needed in the first place?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohhhh, we're trying to set a value of a function instead of the locale itself. So assuming we need the locale, we could do:

const locale = useSelector(getCurrentLocale)

Is this correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right that fixes it, i haven't seen any trackEvent passing the locale, so i removed, i guess i can put it back just in case and merge 🙏 thanks!

Copy link
Contributor

@bergeron bergeron Jun 12, 2024

Choose a reason for hiding this comment

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

I think selecting the locale here is fine, although it may not be necessary since it looks like events automatically get locale added on this line.

@sahar-fehri sahar-fehri added needs-assets-ux-review A shared label between the Assets and UX team to flag PRs ready for consolidated team review. team-assets labels Jun 12, 2024
@bergeron
Copy link
Contributor

nice find 😎

Copy link
Contributor

@legobeat legobeat left a comment

Choose a reason for hiding this comment

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

Fix works for me.

Should this also have some failing e2e test associated with it?

@bergeron
Copy link
Contributor

I expect this would need to be cherry picked to 12.0.0

@metamaskbot
Copy link
Collaborator

Builds ready [43e4a1a]
Page Load Metrics (47 ± 3 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6310778105
domContentLoaded9121010
load40654773
domInteractive9121010
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 23 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.61%. Comparing base (92e6b94) to head (43e4a1a).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #25279   +/-   ##
========================================
  Coverage    65.61%   65.61%           
========================================
  Files         1372     1372           
  Lines        54519    54520    +1     
  Branches     14282    14282           
========================================
+ Hits         35770    35771    +1     
  Misses       18749    18749           

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

@sahar-fehri
Copy link
Contributor Author

Fix works for me.

Should this also have some failing e2e test associated with it?

Hey @legobeat , i started creating the e2e test for this case, then realized that the modal can't be shown in the test because process.env.IN_TEST is equal true in the tests.

In the code, the showAutoDetectionModal depends on canSeeModals which also depends on process.env.IN_TEST
const canSeeModals = completedOnboarding && (!onboardedInThisUISession || firstTimeFlowType === FirstTimeFlowType.import) && !process.env.IN_TEST && !newNetworkAddedConfigurationId;

and

const showAutoDetectionModal =
      canSeeModals &&
      isShowTokenAutodetectModal &&
      !showSmartTransactionsOptInModal &&
      !showWhatsNew;

I wasn't sure what was the context of having the !process.env.IN_TEST check in the canSeeModals, and mocking it in the test seemed to be tricky ..

@sahar-fehri sahar-fehri merged commit 64c2497 into develop Jun 13, 2024
74 checks passed
@sahar-fehri sahar-fehri deleted the fix/token-detection-modal-stuck branch June 13, 2024 16:06
@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 13, 2024
@darkwing darkwing added release-blocker This bug is blocking the next release release-12.0.0 Issue or pull request that will be included in release 12.0.0 and removed release-12.1.0 Issue or pull request that will be included in release 12.1.0 labels Jun 13, 2024
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-12.0.0 Issue or pull request that will be included in release 12.0.0 release-blocker This bug is blocking the next release team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Can not access wallet after unlock
6 participants