lightning-browser-extension
lightning-browser-extension copied to clipboard
Sometimes fiat value appear as 0 but should show none info or other kind of rendering
Describe the bug
Sometimes I open Alby and I look to see how much the sats I have is representing in fiat. But sometimes maybe because it take some seconds to load or maybe because the fiat quote provider service is offline, the value appear as 0.
Screenshots of the changes [optional]
This screenshot is working ok, I couldn't take a screenshot reproducing the problem
To Reproduce
The problem is hard to reproduce, maybe when fiat quote provider is slow or offline
Expected behavior
Not show 0 but instead show none information or some other kind of rendering.
Alby information
- Alby Version: 1.17
I feel it shows 0 because initialState of currencyRate is set to be 0 https://github.com/getAlby/lightning-browser-extension/blob/49705ab42ed5f9efaeb4c1d21c7832610f0d1e2e/src/app/context/SettingsContext.tsx#L30
Here it is multiplying the currency rate with the amount, which might result in this 0 value shown in the above issue. https://github.com/getAlby/lightning-browser-extension/blob/bbe56b879e50e4650519946bb65e0122d13ef168/src/common/utils/currencyConvert.ts#L7
Initial stage of fiatBalance : https://github.com/getAlby/lightning-browser-extension/blob/5156710bce3f21ce543a0f2fda89f0db2e724318/src/app/context/AccountContext.tsx#L53
We can add a check when we have some satsBalance and fiatBalance is 0, we can show loading icon like this
@bitcoinuser is the 0
usually replaced by a fiat value after some time/seconds or does it stay?
If this just shows during loading we could i.e. just show ...
if fiat is 0
as a first fix. No need to add a spinner I think.
is the 0 usually replaced by a fiat value after some time/seconds or does it stay?
The 0 is replaced by fiat after some time.
If this just shows during loading we could i.e. just show ... if fiat is 0 as a first fix. No need to add a spinner I think.
Agree
yes, esp. in slow connections this happens and is visible.
I feel we can change this with below mentioned changes in the image
Current Code: https://github.com/getAlby/lightning-browser-extension/blob/5156710bce3f21ce543a0f2fda89f0db2e724318/src/app/components/AccountMenu/index.tsx#L95-L97
Proposed Changes:
Hm, currency depends on the settings. So checking for i.e. $
will not cover all cases, right?
Play around with the currencies in "settings".
Wanna check what solution might work better here?
Hm, currency depends on the settings. So checking for i.e.
$
will not cover all cases, right?
Oh I forgot that one. Will make it dynamic.
@escapedcat I have opened a PR for this issue with the proposed changes. Can you assign this issue to me?