Commit d42d736
fix: cp-7.59.0 fix crash when hiding token on token details in android (#22327)
## **Description**
PR to fix undefined error when trying to hide a token from Asset details
page.
## **Changelog**
CHANGELOG entry: Fixed a bug that was causing app crash when trying to
hide a token from asset details page.
## **Related issues**
Fixes: #22325
## **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] -->
https://github.com/user-attachments/assets/c2eafdbd-2399-4294-b37b-7f04e8e5e00c
### **After**
<!-- [screenshots/recordings] -->
https://github.com/user-attachments/assets/a6c9e115-9399-47ab-ae2b-3511db97cbff
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Refactors AssetDetails to a container/presentational pattern that
resolves the token via normalized address matching and passes it in,
returning null if missing.
>
> - **Asset Details refactor**:
> - Introduce `AssetDetailsContainer` that:
> - Selects tokens by `chainId`/account, finds the token using
`areAddressesEqual(address)`.
> - Returns `null` if the token is not found.
> - Passes the resolved `token` to `AssetDetails`.
> - Update `AssetDetails` to accept a `token` prop and remove internal
token selection logic.
> - **Address handling**: Use `areAddressesEqual` for robust token
address comparison.
> - **Export**: Default export switched to `AssetDetailsContainer`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4af9f02. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: sahar-fehri <sahar.fehri@consensys.net>1 parent 1c5f2ec commit d42d736
1 file changed
+37
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
114 | 117 | | |
| 118 | + | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
121 | | - | |
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
| |||
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | 137 | | |
140 | 138 | | |
141 | 139 | | |
| |||
155 | 153 | | |
156 | 154 | | |
157 | 155 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 156 | + | |
166 | 157 | | |
167 | 158 | | |
168 | 159 | | |
| |||
398 | 389 | | |
399 | 390 | | |
400 | 391 | | |
401 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
0 commit comments