liteflow-labs / liteflow-js

Mono repo containing all the JS libraries of Liteflow
https://liteflow.com
Apache License 2.0
7 stars 1 forks source link

Price input on bid form: multiple special characters will cause crash #23

Closed cpvdeveloper closed 1 year ago

cpvdeveloper commented 2 years ago

Steps to reproduce:

  1. On the demo app, go to "Place a Bid" form on a token (https://nft.liteflow.com/)
  2. In the "price" input enter a special number character twice (special number characters are . | + | E | e | -)
  3. App will crash after second special character input

This is because the price input value is being manipulated with BigNumber functions, which cannot understand these multiple special characters.

Also tracking this issue on the O-MEE social app repo: https://github.com/liteflow-labs/o-mee/pull/36. Ideally, it would be fixed in the @nft/* hook that's throwing the error, so that it will fix it across all applications.


Fix to implement: Catch the error from BigNumber parse function. Return an undefined value. Make sure to update UI to be compatible with the undefined value.

NicolasMahe commented 2 years ago

Thanks for this bug report!

NicolasMahe commented 2 years ago

It seems a user got this error on hodooi 6 days ago: https://app.bugsnag.com/liteflow-1/hodooi-frontend/errors/630de486a881d100081531b9?filters%5Bapp.release_stage%5D%5B%5D=production&i=em&m=ws

Error/tokens/56-0x1e4fc916afcf548a2e62c5865fefe2069755a3a3-11147357005540778774070140346021913385609048046153189493252358108513454692497/offer
invalid BigNumber string (argument="value", value="NaN", code=INVALID_ARGUMENT, version=bignumber/5.6.2)
cpvdeveloper commented 2 years ago

@NicolasMahe quick fix PR for it here: https://github.com/liteflow-labs/nft/pull/2010

antho1404 commented 2 years ago

One thing that could work is to use the valueAsNumber on the numbers input and that should solve the issue as values like .2 should be recognized as 0.2.

More context here https://github.com/liteflow-labs/backend/pull/2010#issuecomment-1296114651

NicolasMahe commented 1 year ago

This should be fixed by this already merged PR: https://github.com/liteflow-labs/liteflow-js/pull/68

@achampagnedev please check again if this issue is still there and re-open if needed