Skip to content

fix: cp-7.57.0 app bricks on asset sorting#21256

Merged
juanmigdr merged 1 commit into
mainfrom
fix/app-brick-on-asset-sort
Oct 16, 2025
Merged

fix: cp-7.57.0 app bricks on asset sorting#21256
juanmigdr merged 1 commit into
mainfrom
fix/app-brick-on-asset-sort

Conversation

@juanmigdr

@juanmigdr juanmigdr commented Oct 16, 2025

Copy link
Copy Markdown
Member

Description

From the Home token list, if the user sets a sort/filter such as Descending by balance, the app crashes to the generic error screen on next render and becomes unrecoverable. Force-quitting and relaunching does not help; only uninstall + reinstall clears the state. The crash message indicates the Wallet view throws on localeCompare of null.

Changelog

CHANGELOG entry:

Related issues

Fixes: #21218

Manual testing steps

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

Before

After

Pre-merge author checklist

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.

Note

Update sortAssets to move nullish values to the end during sorting and add tests for null handling in alphaNumeric asc/desc cases.

  • Utils:
    • Update app/components/UI/Tokens/util/sortAssets.ts to treat null like undefined (aValue == null / bValue == null) so nullish values are always placed at the end regardless of order.
  • Tests:
    • Add tests in app/components/UI/Tokens/util/sortAssets.test.ts to verify alphaNumeric sorting with null names in both ascending and descending orders.

Written by Cursor Bugbot for commit 420abbc. This will update automatically on new commits. Configure here.

@juanmigdr juanmigdr requested a review from a team as a code owner October 16, 2025 08:11
@juanmigdr juanmigdr enabled auto-merge October 16, 2025 08:16
@juanmigdr juanmigdr changed the title fix: app bricks on asset sorting fix: cp-7.57.0 app bricks on asset sorting Oct 16, 2025
@sonarqubecloud

Copy link
Copy Markdown

}

if (bValue === undefined) {
if (bValue == null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will stop it from crashing if it's null, but make it crash if it's undefined. We probably should check both just to be safe.

if (bValue === undefined || bValue === null)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, x == null is a shortcut to x === null || x === undefined 🚀

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You taught me this yesterday ??= and I show you this today! 😄

@juanmigdr juanmigdr added this pull request to the merge queue Oct 16, 2025
Merged via the queue into main with commit 26ca44f Oct 16, 2025
102 of 108 checks passed
@juanmigdr juanmigdr deleted the fix/app-brick-on-asset-sort branch October 16, 2025 09:44
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2025
@metamaskbot metamaskbot added release-7.58.0 Issue or pull request that will be included in release 7.58.0 release-7.57.0 Issue or pull request that will be included in release 7.57.0 and removed release-7.58.0 Issue or pull request that will be included in release 7.58.0 labels Oct 16, 2025
@metamaskbot

Copy link
Copy Markdown
Collaborator

Missing release label release-7.57.0 on PR. Adding release label release-7.57.0 on PR and removing other release labels(release-7.58.0), as PR was cherry-picked in branch 7.57.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.57.0 Issue or pull request that will be included in release 7.57.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App crash when sorting/filtering on home main wallet view

3 participants