Page MenuHomePhabricator

[Cashtab] Patch token qty rendering error on NFT collection genesis
ClosedPublic

Authored by bytesofman on Jul 15 2024, 18:07.

Details

Summary

Diff to resolve reported bug where user, after creating an NFT collection, may encounter an app-crashing error.

Looking into what happened here:

image.png (874×1 px, 652 KB)

  • User creates a new NFT collection
  • Cashtab auto-routes the user to the Token page for this collection, so the user can start minting or other token action
  • App crashes

From the error msg, crash is coming bc an input param passed to decimalizedTokenQtyToLocaleFormat is undefined

This makes sense bc this param comes from a cache request or an API call, and is not (necessarily) expected to be available, tho I have not come across this issue before. This is an existing issue that is not related to the NFT diff.

Updated to show a loader for values that are not yet available, preventing the function call unless we have the right kind of param. Added a test for the locale and qty of the report to confirm that this was not the issue.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

handle potential render errors for cases where decimalizedTokenQtyToLocaleFormat may have undefined input

remove debug log, type check that input param is a string (specific, reqd) instead of type checking input param is not undefined

specify locale in test desc

This revision is now accepted and ready to land.Jul 16 2024, 08:01