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

Handles potentially null states for coin balance changes #791

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

kaw2k
Copy link
Contributor

@kaw2k kaw2k commented Sep 25, 2024

@ying-w found a transaction with both null owner_address as well as associated asset_type. This PR adds null checking and an empty state for that case. Note the asset type on the second row is gone for the amount. Also, the address on the far left is absent. Previously this would just crash the page.

image

@kaw2k kaw2k self-assigned this Sep 25, 2024
Copy link

netlify bot commented Sep 25, 2024

Deploy Preview for aptos-explorer ready!

Name Link
🔨 Latest commit 28a5017
🔍 Latest deploy log https://app.netlify.com/sites/aptos-explorer/deploys/66f418990edca2000883db81
😎 Deploy Preview https://deploy-preview-791--aptos-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@chiumax chiumax changed the title Handels potentially null states for coin balance changes Handles potentially null states for coin balance changes Sep 25, 2024
@@ -235,8 +235,8 @@ export function useTransactionBalanceChanges(txn_version: string) {
? BigInt(-a.amount)
: BigInt(a.amount),
asset: {
decimals: a.metadata.decimals,
symbol: a.metadata.symbol,
decimals: a.metadata?.decimals,
Copy link
Member

Choose a reason for hiding this comment

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

this causes the page not to crash anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the metadata object was null, and there were no error boundaries, so the entire page crashed.

@kaw2k kaw2k merged commit 29f23e1 into main Sep 25, 2024
7 checks passed
@kaw2k kaw2k deleted the rasa/null-balance-changes branch September 25, 2024 21:34
@ying-w
Copy link
Contributor

ying-w commented Sep 25, 2024

for context, null states can occur when object is deleted in that transaction

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.

4 participants