Skip to content

Commit

Permalink
Merge pull request #49098 from Expensify/vit-cardListForMissingDetails
Browse files Browse the repository at this point in the history
Ensure the form to ship physical expensify card using correct cardID
  • Loading branch information
luacmartins authored Sep 12, 2024
2 parents cfe3d36 + b7c8972 commit 7748eff
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/pages/MissingPersonalDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import * as LoginUtils from '@libs/LoginUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as PhoneNumberUtils from '@libs/PhoneNumber';
import * as ValidationUtils from '@libs/ValidationUtils';
import withPolicyAndFullscreenLoading from '@pages/workspace/withPolicyAndFullscreenLoading';
import type {WithPolicyAndFullscreenLoadingProps} from '@pages/workspace/withPolicyAndFullscreenLoading';
import * as PersonalDetails from '@userActions/PersonalDetails';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand All @@ -32,15 +30,14 @@ import type {CountryZipRegex, CustomSubStepProps} from './types';

const formSteps = [LegalName, DateOfBirth, Address, PhoneNumber];

function MissingPersonalDetails({policy}: WithPolicyAndFullscreenLoadingProps) {
function MissingPersonalDetails() {
const styles = useThemeStyles();
const {translate} = useLocalize();
const ref: ForwardedRef<InteractiveStepSubHeaderHandle> = useRef(null);
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS);
const workspaceAccountID = policy?.workspaceAccountID ?? -1;
const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID.toString()}_${CONST.EXPENSIFY_CARD.BANK}`);
const [cardList] = useOnyx(ONYXKEYS.CARD_LIST);

const firstUnissuedCard = useMemo(() => Object.values(cardsList ?? {}).find((card) => card.state === CONST.EXPENSIFY_CARD.STATE.STATE_NOT_ISSUED), [cardsList]);
const firstUnissuedCard = useMemo(() => Object.values(cardList ?? {}).find((card) => card.state === CONST.EXPENSIFY_CARD.STATE.STATE_NOT_ISSUED), [cardList]);

const handleFinishStep = useCallback(() => {
Navigation.goBack();
Expand Down Expand Up @@ -214,4 +211,4 @@ function MissingPersonalDetails({policy}: WithPolicyAndFullscreenLoadingProps) {

MissingPersonalDetails.displayName = 'MissingPersonalDetails';

export default withPolicyAndFullscreenLoading(MissingPersonalDetails);
export default MissingPersonalDetails;

0 comments on commit 7748eff

Please sign in to comment.