diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index db21700a0c47..891a3d370085 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -124,7 +124,12 @@ function WorkspacesListPage() { const workspaceAccountID = PolicyUtils.getWorkspaceAccountID(policyIDToDelete ?? '-1'); const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`); const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`); - const hasCardFeedOrExpensifyCard = !isEmptyObject(cardFeeds) || !isEmptyObject(cardsList); + const policyToDelete = PolicyUtils.getPolicy(policyIDToDelete); + const hasCardFeedOrExpensifyCard = + !isEmptyObject(cardFeeds) || + !isEmptyObject(cardsList) || + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + ((policyToDelete?.areExpensifyCardsEnabled || policyToDelete?.areCompanyCardsEnabled) && policyToDelete?.workspaceAccountID); const confirmDeleteAndHideModal = () => { if (!policyIDToDelete || !policyNameToDelete) {