Closed NicolaLS closed 2 months ago
returning null
if findAccount
returns nothing feels lazy but is actually the graceful outcome of the Send
component right now:
https://github.com/BitBoxSwiss/bitbox-wallet-app/blob/87d6219ddb566a52aa410c54cd75d63669e5cec6/frontends/web/src/routes/account/send/send.tsx#L523-L526
But right now it could also crash because of the non-null assertion used.
The Send component interacts with one account per transaction which is why it makes sense to refactor the component to only take one account instead of a list of all accounts and the code of the relevant account.
This has several benefits:
getAccount()!.coinCode
for example)Small PR working towards convert send.tsx to functional component. I will open a few small PR's and try to reduce the size of
Send
/make it easier to understand, and then eventually open a bigger PR to convert it to its own functional component.But it will not be possible to do all refactoring before the big PR, for example a custom hook might be useful but can only be used when the component is functional itself.