fix: fix the counter in the header
Description
This PR introduces a fix for the management of the counter in the menu. Currently, the counter does not work for Snap notifications if wallet notifications are not enabled. The PR revises the logic we use to manage the count to be displayed by using a hook (instead of selectors) and verifying in the header when to show the counter. In this way, the user has the ability to see the presence of received Snap notifications regardless of whether they have enabled wallet notifications.
Related issues
Fixes:
Manual testing steps
In the case of unread notifications, a small counter with a red background is visible above the three dots for opening the menu, indicating the number of unread notifications.
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using JSDoc format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
Pre-merge reviewer checklist
- [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
- [x] 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.
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.
Codecov Report
Attention: Patch coverage is 93.10345% with 2 lines in your changes are missing coverage. Please review.
Project coverage is 65.72%. Comparing base (
d0a0037) to head (5622c0c).
| Files | Patch % | Lines |
|---|---|---|
| ui/components/multichain/app-header/app-header.js | 66.67% | 1 Missing :warning: |
| ...i/components/multichain/global-menu/global-menu.js | 75.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #24733 +/- ##
===========================================
+ Coverage 65.69% 65.72% +0.02%
===========================================
Files 1359 1360 +1
Lines 54006 54009 +3
Branches 14038 14039 +1
===========================================
+ Hits 35479 35493 +14
+ Misses 18527 18516 -11
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [278fb54]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (617 ± 545 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 67 | 340 | 106 | 58 | 28 |
| domContentLoaded | 9 | 54 | 17 | 10 | 5 | ||
| load | 55 | 4034 | 617 | 1134 | 545 | ||
| domInteractive | 9 | 54 | 17 | 10 | 5 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 619 Bytes (0.01%)
- common: 0 Bytes (0.00%)
Builds ready [5622c0c]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (1254 ± 642 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 60 | 211 | 103 | 37 | 18 |
| domContentLoaded | 9 | 32 | 16 | 7 | 3 | ||
| load | 48 | 3381 | 1254 | 1336 | 642 | ||
| domInteractive | 9 | 32 | 16 | 7 | 3 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 619 Bytes (0.01%)
- common: 0 Bytes (0.00%)
Builds ready [cf4ff5c]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (946 ± 573 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 67 | 187 | 107 | 36 | 17 |
| domContentLoaded | 9 | 62 | 17 | 15 | 7 | ||
| load | 56 | 2941 | 946 | 1194 | 573 | ||
| domInteractive | 9 | 62 | 17 | 15 | 7 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 619 Bytes (0.01%)
- common: 0 Bytes (0.00%)