Commit 9f52a9c
authored
fix(perps): resolve blank activity tabs from perps home (#27509)
<!--
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?
-->
This PR fixes intermittent Activity tab rendering issues and tab-switch
latency when entering Activity from Perps Home (Perps Home -> Activity
-> back -> Activity, and subsequent tab switches).
Reason for the change
- Users could see a selected Activity tab with no rows rendered,
especially on repeated entry from Perps.
- This was caused by timing issues between initial tab selection and
deferred tab content loading.
Improvement / solution
- Updated ActivityView to set the initial tab index from route params on
mount (instead of relying on post-mount tab switching), then clear
redirect params on focus.
- Hardened shared TabsList tab loading with InteractionManager
scheduling plus a fallback timeout, so tab content still loads when
interaction callbacks are delayed.
- Added a stale callback safeguard in TabsList so an older interaction
callback cannot cancel a newer tab's pending load.
- Added/updated regression tests for async tab-loading behavior,
stale-callback handling, and repeated Perps entry navigation paths.
Out of scope / follow-up
- This PR intentionally does not fix the Predictions tab infinite
spinner.
- The Predictions behavior appears to be a separate feature-specific
loading lifecycle issue and is deferred to a
follow-up with the Predictions owners.
## **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: Fixed a bug where Perps activity could appear blank
after reopening the Activity screen from Perps home.
## **Related issues**
https://consensyssoftware.atlassian.net/browse/TAT-2614
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]
```
```
Feature: Activity tab loading and switching from Perps entry
Scenario: user re-enters Activity from Perps and sees data
Given the user is on Perps Home with account activity available
When user opens Activity, goes back to Perps Home, and opens Activity again
Then the selected Activity tab loads its rows instead of showing a blank body
Scenario: user switches tabs in Activity from Perps entry
Given the user opened Activity from Perps Home
When user taps Transactions, Transfers, and Perps tabs
Then each tab becomes selected promptly and shows loading/content without a multi-second delay
Scenario: user opens Perps tab repeatedly without blank state
Given the user is on Activity with Perps tab enabled
When user switches away from Perps and then back to Perps multiple times
Then Perps activity content continues to render reliably on each return
Scenario: user does not hit tab-switch crash
Given the user is on Activity opened from Perps Home
When user taps between Activity tabs
Then the app does not crash and no red-screen error is shown
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
https://github.com/user-attachments/assets/b425e3dd-37c1-45f8-bf06-62e176bc4046
### **After**
<!-- [screenshots/recordings] -->
https://github.com/user-attachments/assets/6a92a910-4fad-44d4-9646-dfef510cc138
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches shared `TabsList` loading/scheduling and Activity/Perps screen
focus behavior; mistakes could reintroduce blank tabs or regress tab
switching/refresh timing.
>
> **Overview**
> Fixes intermittent **blank Activity tab content** when entering
Activity from Perps by selecting the correct tab *at mount time*
(`ActivityView` now derives `initialActiveIndex` from route params and
clears redirect params on focus, instead of imperatively switching tabs
post-mount).
>
> Hardens `TabsList` on-demand rendering by scheduling active-tab
loading via `InteractionManager` **with a 250ms fallback timeout** and
centralized cancellation, improving reliability when
`runAfterInteractions` callbacks are delayed/missed.
>
> Updates Perps Activity content behavior: `PerpsTransactionsView` now
**refetches on screen focus** and shows a skeleton when
disconnected/focus-refreshing with no cached rows; tests were
expanded/adjusted across tabs and Perps views to cover the new timing
and loading guarantees.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
36e8a2a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent e0486ca commit 9f52a9c
9 files changed
Lines changed: 495 additions & 160 deletions
File tree
- app
- component-library/components-temp/Tabs/TabsList
- components
- UI/Perps
- Views
- PerpsTransactionsView
- components/PerpsMarketTabs
- types
- Views/ActivityView
Lines changed: 212 additions & 47 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 85 | + | |
89 | 86 | | |
90 | 87 | | |
91 | 88 | | |
| |||
198 | 195 | | |
199 | 196 | | |
200 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
201 | 260 | | |
202 | 261 | | |
203 | 262 | | |
| |||
454 | 513 | | |
455 | 514 | | |
456 | 515 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
| 516 | + | |
| 517 | + | |
468 | 518 | | |
469 | 519 | | |
470 | 520 | | |
| |||
477 | 527 | | |
478 | 528 | | |
479 | 529 | | |
480 | | - | |
481 | | - | |
| 530 | + | |
482 | 531 | | |
| 532 | + | |
483 | 533 | | |
484 | 534 | | |
485 | 535 | | |
| |||
499 | 549 | | |
500 | 550 | | |
501 | 551 | | |
502 | | - | |
| 552 | + | |
503 | 553 | | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | 554 | | |
514 | 555 | | |
515 | 556 | | |
| |||
524 | 565 | | |
525 | 566 | | |
526 | 567 | | |
527 | | - | |
| 568 | + | |
528 | 569 | | |
529 | 570 | | |
530 | 571 | | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | 572 | | |
535 | 573 | | |
536 | | - | |
537 | | - | |
| 574 | + | |
| 575 | + | |
538 | 576 | | |
539 | 577 | | |
540 | | - | |
| 578 | + | |
541 | 579 | | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
| 580 | + | |
| 581 | + | |
550 | 582 | | |
551 | 583 | | |
552 | 584 | | |
| |||
563 | 595 | | |
564 | 596 | | |
565 | 597 | | |
566 | | - | |
| 598 | + | |
567 | 599 | | |
568 | 600 | | |
569 | 601 | | |
570 | 602 | | |
571 | 603 | | |
572 | 604 | | |
573 | 605 | | |
574 | | - | |
| 606 | + | |
575 | 607 | | |
576 | 608 | | |
577 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
578 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
579 | 744 | | |
580 | 745 | | |
581 | 746 | | |
| |||
0 commit comments