Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Nft chainId and current global chainId arent always the same #30517

Merged
merged 6 commits into from
Feb 25, 2025

Conversation

gambinish
Copy link
Contributor

@gambinish gambinish commented Feb 22, 2025

Description

Fixes a bug, where the network badge on the top of the nft in the nft details page did not correspond to the chain it belonged to. This resulted in navigating to send screen on a network that the NFT did not belong to.

This PR introduces two things:

  1. Show correct NFT chain badge on NFT details screen, regardless of which network user is on
  2. When navigating to the send flow for an NFT, where the network the NFT belongs to is not the globally selected chainId, change the network on behalf of the user so that the globally selected chainId is the same as the NFT being sent.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to NFT Grid
  2. Navigate to an NFT details screen on Ethereum Mainnet
  3. Change global network to Linea
  4. Should not see the network badge change on the NFT
  5. Click send
  6. See that network is changed on behalf of user from Linea back to Ethereum, where the NFT belongs

Screenshots/Recordings

Before

Screen.Recording.2025-02-21.at.7.19.21.PM.mov

After

Screen.Recording.2025-02-21.at.6.47.06.PM.mov

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.

@gambinish gambinish requested a review from darkwing February 22, 2025 02:48
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

Builds ready [c2c44ea]
Page Load Metrics (1605 ± 94 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint55421041525271130
domContentLoaded13662124157419694
load13822140160519594
domInteractive23183664321
backgroundConnect1274372110
firstReactRender1375302311
getState467182010
initialActions01000
loadScripts9521727117317283
setupStore77416199
uiStartup15562366181719292
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 577 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [03b877d]
Page Load Metrics (1632 ± 50 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint40818111509369177
domContentLoaded13901747159310450
load14411812163210450
domInteractive21123543115
backgroundConnect1285412512
firstReactRender1376312311
getState55414136
initialActions01000
loadScripts1006134111759646
setupStore75913136
uiStartup15932049184511756
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 577 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

Comment on lines +901 to +905
function NftDetails({ nft }: { nft: Nft }) {
const { chainId } = useParams();

return <NftDetailsComponent nft={nft} nftChainId={chainId ?? ''} />;
}
Copy link
Contributor Author

@gambinish gambinish Feb 24, 2025

Choose a reason for hiding this comment

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

Had to make this additional wrapper to satisfy the storybook ci test. It didn't like me using useParams in storybook and only wanted props (rather than an internal hook), so this wrapper allows me to bypass that issue while maintaining functionality.

@gambinish gambinish marked this pull request as ready for review February 24, 2025 20:50
@metamaskbot
Copy link
Collaborator

Builds ready [ec16cfd]
Page Load Metrics (1625 ± 52 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint45518271555274131
domContentLoaded13911809160011153
load14091830162510952
domInteractive24128493014
backgroundConnect65127136
firstReactRender1481362613
getState45815189
initialActions01000
loadScripts985137011779746
setupStore770182010
uiStartup16002054185311254
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 708 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@darkwing darkwing left a comment

Choose a reason for hiding this comment

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

This is great!

@metamaskbot
Copy link
Collaborator

Builds ready [76097d3]
Page Load Metrics (1760 ± 69 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint35820581631422203
domContentLoaded14582012173014168
load14712058176014569
domInteractive277941157
backgroundConnect979312110
firstReactRender1576312311
getState47017199
initialActions01000
loadScripts10351534129612058
setupStore771262411
uiStartup16602354200216378
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 708 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

@gambinish gambinish added this pull request to the merge queue Feb 25, 2025
Merged via the queue into main with commit 78c5d2c Feb 25, 2025
79 checks passed
@gambinish gambinish deleted the fix/bug-nft-multichain-logo branch February 25, 2025 01:18
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2025
@metamaskbot metamaskbot added the release-12.14.0 Issue or pull request that will be included in release 12.14.0 label Feb 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.14.0 Issue or pull request that will be included in release 12.14.0 team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants