-
Notifications
You must be signed in to change notification settings - Fork 129
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
fix: DarthCoin rant #2898
base: main
Are you sure you want to change the base?
fix: DarthCoin rant #2898
Conversation
The force is strong with this one |
i approve of this message. |
63bbe9b
to
c589d38
Compare
} | ||
}, [secondaryNewAmount, setNumberPadAmount, client, swapDefaultUnitOfAccount]) | ||
|
||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this cause a flicker allowing it to render the initial amount and then on the next render switching to the default? I wonder if the change needs to be made before getting to this component, so that the first time it renders it is rendering the correct money amount.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not seen any flicker in my simulator. I think there were to do some calculation before rendering but I don't remember what it was anymore, I'll look for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing obvious coming to mind from my convo with GPT4. let's merge and see how it behaves and this is an issue?
secondaryNewAmount && | ||
(() => { | ||
const client = useApolloClient() | ||
const swapDefaultUnitOfAccount = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this implementation may have a bug. Its not a given that the primary amount is always the display currency or always the settlement currency. If swap was set to true and one use of the component passes in a display amount and another use of the component passes in a settlement amount, they would both end up swapping . A more accurate name would be useDisplayAmountAsInitialAmount
and then you could explicitly handle the amount currencies before they reach this component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in what scenario would we not have a display currency or settlement currency? ie: what would make it that the order would be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If on receive screen the initial primary amount was set to 0 Display
as the default and if on the send flow the primary amount was set to 0 BTC
as the default. This isn't what we do now, but we dont have anything in place to prevent someone from misusing the component.
Right now I believe we leave the amounts as undefined and then the initial amount is set in this line https://github.com/GaloyMoney/galoy-mobile/blob/c7c81a1f9d2df633e76752b964ab1a82555c3041/app/components/amount-input-screen/amount-input-screen.tsx#L147 with the zeroDisplayAmount
. We could get rid of needSwapCurrencyInit
and in this line use the value useDisplayAmountAsDefaultAmount
to decide between zeroDisplayAmount
and zeroSettlementAmount
as the default.
Actually the reason we have fiat as default is because we consider the noob scenario as a key thing here. noob will always set their price in fiat term, so if we always have fiat by default, they're less likely to enter an amount under a wrong denomination my assumption is this is a feature for a power user that want to have sats as the default unit of account when they type an amount |
Education of noobs start by changing their mindset, slowly, from fiat to BTC. Who wants to live in the fiat standard, fine. They can keep displaying fiat. |
aka: saving unit of account used when typing an amount