Skip to content

Commit ec5273f

Browse files
leshniakclaude
andcommitted
fix: hide Expensify card feed and cards when feed settings are pending delete
Filter out card feeds with pendingAction: DELETE in getAdminExpensifyCardFeedEntries so they no longer appear in feed selector dropdowns. Also guard WorkspaceExpensifyCardPage to show empty state instead of stale card data when the selected feed is pending deletion — matches the company card flow pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1153c4b commit ec5273f

3 files changed

Lines changed: 24 additions & 22 deletions

File tree

src/libs/ExpensifyCardFeedSelectorUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function isFeedPrimaryForPolicy(entry: ExpensifyCardFeedEntry, policyID: string)
6060

6161
function getAdminExpensifyCardFeedEntries(cardSettingsCollection: OnyxCollection<ExpensifyCardSettings> | undefined, policies: OnyxCollection<Policy> | undefined): ExpensifyCardFeedEntry[] {
6262
return Object.entries(cardSettingsCollection ?? {}).flatMap(([settingsKey, settings]) => {
63-
if (!settings) {
63+
if (!settings || settings.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
6464
return [];
6565
}
6666
const fundID = getFundIdFromSettingsKey(settingsKey);

src/pages/workspace/expensifyCard/WorkspaceExpensifyCardFeedSelectorPage.tsx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,26 @@ function WorkspaceExpensifyCardFeedSelectorPage({route}: WorkspaceExpensifyCardF
114114
Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD_BANK_ACCOUNT.getRoute(policyID));
115115
};
116116

117-
const toListItem = (entry: ExpensifyCardFeedEntry, isOtherWorkspaceSection: boolean): ExpensifyFeedListItem => ({
118-
value: entry.fundID,
119-
text: getExpensifyCardFeedDescription(entry.settings, policies),
120-
keyForList: entry.fundID.toString(),
121-
isSelected: entry.fundID === lastSelectedExpensifyCardFeedID,
122-
isDisabled: entry.settings.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || (isOtherWorkspaceSection && isOffline),
123-
pendingAction: entry.settings.pendingAction,
124-
errors: feedWithError?.fundID === entry.fundID ? feedWithError.error : undefined,
125-
leftElement: (
126-
<Icon
127-
src={illustrations.ExpensifyCardImage}
128-
height={variables.cardIconHeight}
129-
width={variables.cardIconWidth}
130-
additionalStyles={[styles.mr3, styles.cardIcon]}
131-
/>
132-
),
133-
});
117+
const toListItem = (entry: ExpensifyCardFeedEntry, isOtherWorkspaceSection: boolean): ExpensifyFeedListItem => {
118+
const isFeedPendingDelete = entry.settings.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
119+
return {
120+
value: entry.fundID,
121+
text: getExpensifyCardFeedDescription(entry.settings, policies),
122+
keyForList: entry.fundID.toString(),
123+
isSelected: entry.fundID === lastSelectedExpensifyCardFeedID,
124+
isDisabled: isFeedPendingDelete || (isOtherWorkspaceSection && isOffline),
125+
pendingAction: entry.settings.pendingAction,
126+
errors: feedWithError?.fundID === entry.fundID ? feedWithError.error : undefined,
127+
leftElement: (
128+
<Icon
129+
src={illustrations.ExpensifyCardImage}
130+
height={variables.cardIconHeight}
131+
width={variables.cardIconWidth}
132+
additionalStyles={[styles.mr3, styles.cardIcon]}
133+
/>
134+
),
135+
};
136+
};
134137

135138
const goBack = () => Navigation.goBack(ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policyID));
136139

src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPage.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) {
4343

4444
const paymentBankAccountID = settings?.paymentBankAccountID ?? CONST.DEFAULT_NUMBER_ID;
4545
const isLoading = !isOffline && (!cardSettings || settings?.isLoading) && !cardSettings?.hasOnceLoaded;
46+
const isFeedPendingDelete = cardSettings?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
4647

4748
const renderContent = () => {
4849
if (isLoading) {
@@ -58,7 +59,7 @@ function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) {
5859
/>
5960
);
6061
}
61-
if (paymentBankAccountID) {
62+
if (paymentBankAccountID && !isFeedPendingDelete) {
6263
return (
6364
<WorkspaceExpensifyCardListPage
6465
cardsList={cardsList}
@@ -67,9 +68,7 @@ function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) {
6768
/>
6869
);
6970
}
70-
if (!paymentBankAccountID) {
71-
return <WorkspaceExpensifyCardPageEmptyState route={route} />;
72-
}
71+
return <WorkspaceExpensifyCardPageEmptyState route={route} />;
7372
};
7473

7574
return (

0 commit comments

Comments
 (0)