Commit 6e619fd
authored
fix(activity): stuck confirmation on back after tx + missing lending deposit token icon cp-8.3.0 (#33157)
## **Description**
Two related Activity-redesign bug fixes on one branch.
**1. Stuck confirmation on back after a transaction (TMCU-1001).**
After submitting a full-screen confirmation (send, Earn pooled-staking,
or stablecoin lending), the app redirects to the Activity screen. With
the Money-account feature enabled, Activity is registered as a
root-level screen, so the redirect pushed it on top of the still-mounted
confirmation — whose approval had already been consumed
(`deleteAfterResult`). Pressing back returned to that consumed
confirmation, which rendered an infinite loader/skeleton.
The fix adds a shared `navigateToActivityAfterConfirmation` helper that
replaces the confirmation's stack with Activity in a single
`StackActions.replace`, removing the stale confirmation from the back
stack. It's wired into the shared transaction confirm hook
(`useTransactionConfirm`), batch approvals (`useConfirmActions`), the
Earn lending deposit/withdrawal views, and the legacy staking footer.
Approach note : I first tried to make "back" return to the transaction
**build** screen (amount / recipient / input). On a native-stack that
means removing the nested confirmation while pushing a root-level
Activity — two screen changes that react-native-screens animates at the
same time, producing a double-navigation on the way in and a flashing
half-finished pop on the way back. After several attempts to work around
the animation, the reliable single-transition solution was to replace
the confirmation's whole stack. As a result: **send/staking → back
returns to Wallet home**; **lending → back returns to the input screen**
(its input lives in a separate stack that survives the replace).
**2. Missing token icon/amount on lending deposit rows (TMCU-1082).**
Lending deposit Activity rows derived their token from the pool contract
(`txParams.to`) instead of the underlying deposited asset, so the row
had no resolvable icon, symbol, or amount. The supplied token is now
resolved from simulation data / the outgoing Transfer log (falling back
to the pool address), and lending token metadata is enriched from the
tokens API; the row avatar uses the resolved token.
## **Changelog**
CHANGELOG entry: Fixed the Activity screen back button returning to a
stuck confirmation screen after a transaction, and fixed the missing
token icon and amount on Earn lending deposit rows.
## **Related issues**
Fixes:
[TMCU-1001](https://consensyssoftware.atlassian.net/browse/TMCU-1001)
Fixes:
[TMCU-1082](https://consensyssoftware.atlassian.net/browse/TMCU-1082)
## **Manual testing steps**
```gherkin
Feature: Activity navigation after a transaction
Background:
Given the Money-account and Activity-redesign feature flags are enabled
Scenario: Back after a send or staking transaction is not stuck
Given I complete a native/ERC-20/NFT send, or an ETH pooled-staking deposit/unstake/claim
When I am redirected to the Activity screen and tap the back button
Then I return to Wallet home
And I never land on the consumed confirmation screen or an infinite loader
Scenario: Back after a lending deposit returns to the input screen
Given I complete a stablecoin (USDC/USDT/DAI) lending deposit or withdrawal
When I am redirected to the Activity screen and tap the back button
Then I return to the lending input screen
And I never land on the consumed confirmation screen
Feature: Lending deposit Activity row
Scenario: Lending deposit row shows the deposited token
Given I complete a stablecoin lending deposit
When I open the Activity list
Then the lending deposit row shows the underlying token's icon, symbol, and amount
```
Also covered by automated tests: real-navigator integration tests for
all three navigation flows
(`navigateToActivityAfterConfirmation.test.tsx`), the redirect call
sites, and the lending row/adapter changes (`ActivityListItemRow`,
`local-transaction`).
## **Screenshots/Recordings**
**Staking Before**
https://github.com/user-attachments/assets/b3fd9f9e-21a7-4614-a87d-911f1073bad1
**Staking After**
https://github.com/user-attachments/assets/7e5ce1e1-bfd1-4d25-9eba-122b572b6848
**NFT Send Before**
https://github.com/user-attachments/assets/dbe4f6c3-24aa-4c57-b687-277cb85bfbfa
**NFT Send After**
https://github.com/user-attachments/assets/3d84d448-9560-4496-acf5-eca162faaec1
**Native Send Before**
https://github.com/user-attachments/assets/c22c9f64-9e32-44b9-8103-ade68a099aa9
**Native Send After**
https://github.com/user-attachments/assets/04a8b1fe-6355-442e-8b3a-f4b9623fc491
**Send Before**
https://github.com/user-attachments/assets/43e326cf-58ab-422a-b08d-db67cf3d5784
**Send After**
https://github.com/user-attachments/assets/a19740a6-bf2c-4217-bd68-aebcd5392820
**Lending Icon Fix Before**
https://github.com/user-attachments/assets/9495b417-ea9a-42ec-aa5d-de382a002cfb
**Lending Icon Fix After**
https://github.com/user-attachments/assets/cf31532e-acb8-4bd8-bda9-ec48ec7c2a88
### **Before**
`~`
### **After**
`~`
## **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
- [ ] 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.
#### Performance checks (if applicable)
- [ ] I've tested on Android
- [ ] I've tested with a power user scenario
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
## **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.
[TMCU-1001]:
https://consensyssoftware.atlassian.net/browse/TMCU-1001?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Navigation stack replacement affects multiple confirmation flows;
lending adapter heuristics could mis-identify tokens on unusual receipt
shapes, though fallbacks and tests cover main paths.
>
> **Overview**
> Fixes two Activity-redesign issues: **post-transaction back
navigation** and **lending deposit row/details display**.
>
> **Post-tx navigation:** Adds `navigateToActivityAfterConfirmation`,
which uses root `StackActions.replace` for Activity when
`TRANSACTIONS_VIEW` is on the root stack (Money-account on), instead of
pushing Activity on top of a consumed confirmation. Falls back to plain
`navigate` otherwise. Wired through `useTransactionConfirm`,
`useConfirmActions`, Earn lending confirm views, and staking footer.
>
> **Lending token display:** `local-transaction` now resolves lending
deposit `sourceToken` from simulation balance decreases or user outgoing
ERC-20 transfers (pool or aToken recipient), not `txParams.to`. New
`enrichTokenFromApi` fills symbol/decimals from the tokens API for
lending rows (`useActivityListItemRowContent`), avatars, and
`SwapDetails` amount headers when adapters only supply atomic amounts +
`assetId`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
212f871. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 28a2264 commit 6e619fd
16 files changed
Lines changed: 959 additions & 29 deletions
File tree
- app
- components
- UI
- ActivityListItemRow
- Earn/Views
- EarnLendingDepositConfirmationView
- EarnLendingWithdrawalConfirmationView
- Views
- ActivityDetails/templates
- confirmations/hooks
- transactions
- util
- activity-adapters
- adapters
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1153 | 1153 | | |
1154 | 1154 | | |
1155 | 1155 | | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1156 | 1214 | | |
1157 | 1215 | | |
1158 | 1216 | | |
| |||
Lines changed: 45 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
1135 | 1136 | | |
1136 | 1137 | | |
1137 | 1138 | | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1138 | 1155 | | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
1139 | 1168 | | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
| 1169 | + | |
1145 | 1170 | | |
1146 | 1171 | | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
1147 | 1176 | | |
1148 | | - | |
| 1177 | + | |
1149 | 1178 | | |
1150 | 1179 | | |
1151 | 1180 | | |
| |||
1225 | 1254 | | |
1226 | 1255 | | |
1227 | 1256 | | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
1228 | 1266 | | |
1229 | 1267 | | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | | - | |
| 1268 | + | |
1234 | 1269 | | |
1235 | 1270 | | |
1236 | 1271 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
418 | | - | |
| 418 | + | |
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
| 319 | + | |
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| |||
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| |||
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | | - | |
| 119 | + | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| |||
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
151 | | - | |
| 150 | + | |
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
| |||
Lines changed: 108 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | | - | |
34 | | - | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
0 commit comments