[pull] main from MetaMask:main#95
Merged
Merged
Conversation
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
- Should BOLD the text in Forget password
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
#18720
### **After**
<!-- [screenshots/recordings] -->
<img width="1010" height="1010" alt="Screenshot 2025-08-25 at 6 10
02 PM"
src="https://github.com/user-attachments/assets/b6623e83-6744-4e6d-8f90-e70004998c9a"
/>
<img width="1025" height="1006" alt="Screenshot 2025-08-25 at 6 10
11 PM"
src="https://github.com/user-attachments/assets/98bb3407-81e5-4c69-aca7-76ba4bd17927"
/>
<img width="1037" height="1013" alt="Screenshot 2025-08-25 at 6 10
43 PM"
src="https://github.com/user-attachments/assets/438c445b-c8b0-41e6-b76b-c0a3b7cfbcdb"
/>
<img width="1021" height="1001" alt="Screenshot 2025-08-25 at 6 10
53 PM"
src="https://github.com/user-attachments/assets/4b456a47-59b1-4c13-8c40-2c6014af08d0"
/>
## **Pre-merge author checklist**
- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [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](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
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.
…nagement (#18703) ## **Description** Improves Perps market loading performance and WebSocket efficiency while fixing connection lifecycle management issues. Introduces intelligent caching and fixes WebSocket duplication through race condition prevention. ### Performance Improvements 1. **Market Data Caching** - New 5-minute cache for market list data - Introduces MarketDataChannel in StreamManager for REST API caching - Cache persists across component remounts and tab switches - Automatic refresh on account/network changes - Centralized configuration in `perpsConfig.ts` - Reduces API calls significantly compared to fetching on every mount 2. **WebSocket Deduplication** - Fixed race condition causing duplicate subscriptions - **Problem:** Multiple duplicate "allMids" subscriptions when market list loads (17+ connections observed) - **Solution:** Promise-based tracking prevents concurrent connection attempts - Maintains efficient leaf-level subscription pattern for virtualized lists - Single WebSocket connection now handles all price updates 3. **Streamlined Data Flow** - Centralized caching via StreamManager - Replaced module-level state variables with StreamManager pattern - Promise-based deduplication prevents concurrent fetches - Consistent pattern across all data channels (positions, orders, markets) - Simplified usePerpsMarkets hook implementation 4. **Performance Tracking & Monitoring** - Enhanced visibility into cache effectiveness - Added comprehensive cache hit/miss logging with timing metrics - Performance measurements track actual data display (not skeleton screens) - Real-time cache age and validity tracking in DevLogger - Sentry integration for production performance monitoring ### Connection Lifecycle Fix **What broke:** After migrating to provider-based connection management, WebSocket connections stopped disconnecting on tab switches because `react-native-scrollable-tab-view` keeps all tabs mounted. **Solution:** 1. **Visibility Tracking** - Callback pattern allows parent to notify of tab changes 2. **App State Handling** - 20-second delay when backgrounded for quick returns 3. **Platform-Specific Timers** - Uses `react-native-background-timer` for reliability ### Impact - **Reduced API calls** - New 5-minute cache prevents repeated market data fetches - **Fewer WebSocket connections** - Fixed race condition eliminates duplicate connections - **Faster market list loading** - 85% faster load times (161ms with cache vs 1150ms without on Pixel 6 Pro) - **Battery/Network savings** - Properly disconnects when not viewing Perps - **Improved reliability** - Race conditions eliminated, proper cleanup on unmount ## **Changelog** CHANGELOG entry: Added market data caching for improved Perps performance, fixed WebSocket duplication issue, and restored proper connection lifecycle management on tab switches ## **Related issues** ## **Manual testing steps** ```gherkin Feature: Perps Performance and Connection Management Scenario: Market list loads from cache Given user has viewed the Perps market list When user navigates away and returns within 5 minutes Then market list should display instantly from cache And no new API call should be made And DevLogger should show cached data being used Scenario: No duplicate WebSocket subscriptions Given user opens the Perps market list When the list renders multiple market items Then DevLogger should show only ONE "Global allMids subscription established" And Network inspector should show single WebSocket connection Scenario: WebSocket disconnects on tab switch Given user is on the Perps tab with active WebSocket When user taps on Tokens tab Then WebSocket connection should disconnect within 1 second And DevLogger should show "Visibility changed" with isVisible: false Scenario: App background handling Given user is viewing the Perps tab When user backgrounds the app Then WebSocket should schedule disconnection in 20 seconds And quick return should cancel the scheduled disconnection Scenario: Cache refresh on context change Given user has cached market data When user switches account or network Then cache should be cleared and fresh data fetched ``` ## **Screenshots/Recordings** ### **Before** - Multiple WebSocket connections on market list load (17+ observed) - API calls on every component mount - Connection remains active when switching tabs ### **After** - Single WebSocket connection for all price updates - Market data cached for 5 minutes (new feature) - Connection properly disconnects on tab switch - **Real device performance (Pixel 6 Pro)**: - First load: 1150ms (fresh API fetch) - Subsequent loads: 161ms (from cache) - 85% improvement in load time ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable (comprehensive test coverage added) - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). 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.
#18716) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR adds navigation to addresses list from the new multichain account item menu <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** https://github.com/user-attachments/assets/ac0d52e6-b149-422d-9a92-50601f99d0f5 <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [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](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). 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.
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Fixes a performance issue by closing all Solana WebSocket connection
whenever the client becomes inactive.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] 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](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )