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: add error boundary on NFT grid items #30486

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Feb 21, 2025

Description

This allows us to capture errors when rendering grid items and prevent them from bubbling up and crashing the app.

Ideally we want to handle the actual causes for the crash. In this case it was an NFT that has 2 images, when we expect a single image string.

Open in GitHub Codespaces

Related issues

Manual testing steps

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.

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.

@Prithpal-Sooriya Prithpal-Sooriya changed the title hotix: add error boundary on NFT grid items fix: add error boundary on NFT grid items Feb 21, 2025
@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review February 24, 2025 11:51
@metamaskbot
Copy link
Collaborator

Builds ready [12324bf]
Page Load Metrics (1673 ± 50 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint23619081537405195
domContentLoaded14871858163510349
load15011919167310450
domInteractive23171423215
backgroundConnect1294352211
firstReactRender1479322311
getState564212010
initialActions01000
loadScripts1052133711979043
setupStore771222311
uiStartup17412233191512861
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 1.12 KiB (0.01%)
  • common: 0 Bytes (0.00%)

type ErrorBoundaryProps = { children: ReactNode; fallback: () => ReactNode };
type ErrorBoundaryState = { hasError: boolean };

class NFTGridItemErrorBoundary extends Component<
Copy link
Contributor

Choose a reason for hiding this comment

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

Sad that error boundaries like this need to be class components, seems like a framework limitation of React.

@metamaskbot
Copy link
Collaborator

Builds ready [96f149a]
Page Load Metrics (1567 ± 57 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint45118621459355170
domContentLoaded13671811154911354
load13891866156712057
domInteractive238235178
backgroundConnect87723189
firstReactRender147224189
getState551192010
initialActions01000
loadScripts1003138711409445
setupStore75819189
uiStartup15752202179013967
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 1.12 KiB (0.01%)
  • common: 0 Bytes (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants