Don't show wallet value until prefs are ready

... because preference might be "Hide wallet = true". This eliminates the gap during login or boot up that temporarily shows the wallet balance.

Ticket: 1365
This commit is contained in:
infinite-persistence 2022-05-12 14:21:17 +08:00
parent f0f1d0f695
commit 40a59c53d4
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 6 additions and 5 deletions

View file

@ -3,7 +3,7 @@ import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
import { doSignOut, doOpenModal } from 'redux/actions/app';
import { doClearClaimSearch } from 'redux/actions/claims';
import { selectClientSetting } from 'redux/selectors/settings';
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
import { selectGetSyncErrorMessage, selectPrefsReady } from 'redux/selectors/sync';
import { selectHasNavigated } from 'redux/selectors/app';
import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet';
import { selectUserVerifiedEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user';
@ -20,6 +20,7 @@ const select = (state) => ({
totalBalance: selectTotalBalance(state),
syncError: selectGetSyncErrorMessage(state),
user: selectUser(state),
prefsReady: selectPrefsReady(state),
});
const perform = (dispatch) => ({

View file

@ -43,6 +43,7 @@ type Props = {
syncError: ?string,
totalBalance?: number,
user: ?User,
prefsReady: boolean,
doClearClaimSearch: () => void,
clearEmailEntry: () => void,
clearPasswordEntry: () => void,
@ -66,6 +67,7 @@ const Header = (props: Props) => {
syncError,
totalBalance,
user,
prefsReady,
doClearClaimSearch,
clearEmailEntry,
clearPasswordEntry,
@ -152,10 +154,8 @@ const Header = (props: Props) => {
navigate={`/$/${PAGES.WALLET}`}
className="button--file-action header__navigationItem--balance"
label={
hideBalance || Number(roundedTotalBalance) === 0
? isMobile
? __('Wallet')
: __('Your Wallet')
hideBalance || Number(roundedTotalBalance) === 0 || !prefsReady
? __(isMobile ? 'Wallet' : 'Your Wallet')
: roundedTotalBalance
}
icon={ICONS.LBC}