Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/pages/workspace/companyCards/addNew/SelectBankStep.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useRoute} from '@react-navigation/native';
import React, {useCallback, useMemo, useState} from 'react';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
import FormHelpMessage from '@components/FormHelpMessage';
Expand Down Expand Up @@ -40,6 +40,13 @@ function SelectBankStep() {
const [hasError, setHasError] = useState(false);
const isOtherBankSelected = bankSelected === CONST.COMPANY_CARDS.BANKS.OTHER;

useEffect(() => {
if (addNewCard?.data.selectedBank !== CONST.COMPANY_CARDS.BANKS.PEX) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add a comment explaining why we exclude PEX here please 🙌🏼

return;
}
setAddNewCompanyCardStepAndData({data: {selectedBank: null}});
}, [addNewCard?.data.selectedBank]);

const submit = useCallback(() => {
if (!bankSelected) {
setHasError(true);
Expand Down Expand Up @@ -70,6 +77,10 @@ function SelectBankStep() {
if (bank === CONST.COMPANY_CARDS.BANKS.MOCK_BANK) {
return CONFIG.ENVIRONMENT !== CONST.ENVIRONMENT.PRODUCTION;
}
// Hide Pex option until it's fully supported in NewDot
if (bank === CONST.COMPANY_CARDS.BANKS.PEX) {
return false;
Comment on lines +81 to +82
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear hidden PEX selection before rendering bank list

Filtering PEX out of data here hides the row, but it does not clear bankSelected, which is sourced from persisted Onyx state. If a user had previously selected PEX (e.g., before this rollout) and lands on this step again, no option appears selected, yet submit() still treats bankSelected as valid and advances with PEX, so the unsupported flow remains reachable despite being hidden.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot implement this suggestion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in d5ac28e. Added a useEffect that checks the persisted selectedBank from Onyx — if it's PEX, it clears the selection by calling setAddNewCompanyCardStepAndData({data: {selectedBank: null}}). This ensures users who previously selected PEX won't silently advance through the unsupported flow.

}
return true;
})
.map((bank) => ({
Expand Down
Loading