Skip to content

Commit

Permalink
Merge pull request #55825 from ikevin127/ikevin127-paymentCurrencyOny…
Browse files Browse the repository at this point in the history
…xCache

Fix currency selected incorrectly after page reload
  • Loading branch information
neil-marcellini authored Jan 29, 2025
2 parents 3cfb4fe + bd1341a commit 242b4c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/AddPaymentCard/PaymentCardForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import INPUT_IDS from '@src/types/form/AddPaymentCardForm';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

type PaymentCardFormProps = {
shouldShowPaymentCardForm?: boolean;
Expand Down Expand Up @@ -132,7 +133,7 @@ function PaymentCardForm({
currencySelectorRoute,
}: PaymentCardFormProps) {
const styles = useThemeStyles();
const [data] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM);
const [data, metadata] = useOnyx(ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM);

const {translate} = useLocalize();
const route = useRoute();
Expand Down Expand Up @@ -204,7 +205,7 @@ function PaymentCardForm({
setCardNumber(validCardNumber);
}, []);

if (!shouldShowPaymentCardForm) {
if (!shouldShowPaymentCardForm || isLoadingOnyxValue(metadata)) {
return null;
}

Expand Down

0 comments on commit 242b4c9

Please sign in to comment.