Skip to content

Conversation

@bayulaksana479
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive error handling for JSON parsing operations throughout the application to prevent crashes from malformed data. The changes wrap JSON.parse calls in try-catch blocks and return sensible fallback values when parsing fails.

  • Fixed a critical bug in the isJson function that was returning inverted boolean values
  • Added try-catch blocks around all JSON parsing operations to prevent runtime errors
  • Refactored JSON parsing in AccountOverviewActions component to use useMemo for better performance

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
apps/app/src/utils/near.ts Added error handling to decodeArgs function, returns empty object on parse failure
apps/app/src/utils/libs.ts Fixed isJson return values (bug fix), added error handling to strToType and parseEventJson functions
apps/app/src/utils/app/near.ts Added error handling to decodeArgs function, returns empty object on parse failure
apps/app/src/utils/app/libs.ts Added error handling to strToType function for JSON case
apps/app/src/hooks/app/useSearchHistory.ts Added error handling for all response.json() calls to gracefully handle corrupted cache data
apps/app/src/hooks/app/useRpc.ts Added error handling to viewMethod when parsing RPC response results
apps/app/src/components/app/Address/AccountOverviewActions.tsx Refactored spam tokens parsing to use useMemo with error handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andrewklau andrewklau merged commit 67b0b55 into main Dec 29, 2025
7 checks passed
@andrewklau andrewklau deleted the fix/json branch December 29, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants