Skip to content

Commit

Permalink
update shouldShowCardsSection and add cardList onyx to get updates in…
Browse files Browse the repository at this point in the history
… time
  • Loading branch information
waterim committed Jan 27, 2025
1 parent 0d7a444 commit 7327454
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const StyleUtils = useStyleUtils();
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`);
const [cardList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}`);

const [isRemoveMemberConfirmModalVisible, setIsRemoveMemberConfirmModalVisible] = useState(false);
const [isRoleSelectionModalVisible, setIsRoleSelectionModalVisible] = useState(false);
Expand All @@ -81,7 +82,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const policyOwnerDisplayName = formatPhoneNumber(getDisplayNameOrDefault(ownerDetails)) ?? policy?.owner ?? '';
const hasMultipleFeeds = Object.values(getCompanyFeeds(cardFeeds)).filter((feed) => !feed.pending).length > 0;

const workspaceCards = getAllCardsForWorkspace(workspaceAccountID);
const workspaceCards = getAllCardsForWorkspace(workspaceAccountID, cardList);
const hasWorkspaceCardsAssigned = !!workspaceCards && !!Object.values(workspaceCards).length;

useEffect(() => {
Expand Down Expand Up @@ -208,7 +209,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
return <NotFoundPage />;
}

const shouldShowCardsSection = hasWorkspaceCardsAssigned && (!!policy?.areExpensifyCardsEnabled || !!policy?.areCompanyCardsEnabled);
const shouldShowCardsSection = (hasWorkspaceCardsAssigned || !!cardFeeds) && (!!policy?.areExpensifyCardsEnabled || !!policy?.areCompanyCardsEnabled);

return (
<AccessOrNotFoundWrapper
Expand Down

0 comments on commit 7327454

Please sign in to comment.