trezor-suite icon indicating copy to clipboard operation
trezor-suite copied to clipboard

Transaction is never fetched after Maximum 2 decimals allowed error is fixed by deleting too many decimals

Open bosomt opened this issue 1 year ago • 3 comments

Describe the bug Transaction is never fetched after Maximum 2 decimals allowed error is fixed by deleting too many decimals

Steps to reproduce:

  1. Try to send more than 2 fiat decimals
  2. Maximum 2 decimals allowed error is rendered
  3. Delete decimals
  4. Transaction is never prepared for signing

Info:

  • Suite version: desktop 24.2.4 (748176286ae231aae44c83981a62b174b7605e1a)
  • Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) TrezorSuite/24.2.4 Chrome/118.0.5993.129 Electron/27.0.4 Safari/537.36
  • OS: MacIntel
  • Screen: 1512x982
  • Device: Trezor T2B1 2.6.4 regular (revision 42e9ed0e09033d474dee1a560fe5870646fa440e)
  • Transport: BridgeTransport 2.0.33

Screenshots:

https://github.com/trezor/trezor-suite/assets/31506317/6b60b0f5-9899-4728-91ae-4b8e3bc63595

bosomt avatar Feb 27 '24 18:02 bosomt

Additional context

https://github.com/trezor/trezor-suite/assets/152851523/d3d7005b-1bcd-4bcc-957d-590064df41e4

MiroslavProchazka avatar Feb 27 '24 18:02 MiroslavProchazka

The problem is here: packages/suite/src/views/wallet/send/components/ReviewButton.tsx

Screenshot 2024-02-29 at 10 36 17

jvaclavik avatar Feb 29 '24 09:02 jvaclavik

Here is the problem:

  • In the ... send/components/Outputs/components/Amount/components/Fiat.tsx there is the problem that it has handleChange directly on the input.
  • In this handler the errors are checked,
  • but those errors comes from hooks and react-hook-form, and are "late" (handleChange happens before the react hook form reevaluates the new state)

This is hell, I suggest to remove react-hook-form completely and rewrite the send from in some sane way.

peter-sanderson avatar Mar 04 '24 16:03 peter-sanderson