Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,16 @@ export const AppMembersDrawer: React.FC<AppMembersDrawerProps> = ({ isOpen, onCl
3. Pending members
*/

const externalDomainMembers =
Object.values(billingTeamMembers)
.filter((member) => {
return !billingTeamDetails?.ownerDomains?.includes(getDomainFromEmail(member.email));
})
.map((member) => {
return {
email: member.email,
domain: member.domain,
};
}) || [];
const externalDomainMembers = Object.values(billingTeamMembers ?? {})
.filter((member) => {
return !billingTeamDetails?.ownerDomains?.includes(getDomainFromEmail(member.email));
})
.map((member) => {
return {
email: member.email,
domain: member.domain,
};
});

const orgMembers = organizationMembers || [];

Expand Down
15 changes: 14 additions & 1 deletion app/src/store/features/billing/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ export const getBillingTeamById = (id: string | undefined) => (state: RootState)
return allAvailableBillingTeams.find((billingTeam) => billingTeam.id === id);
};

export const getBillingTeamMembers = (billingId: string | undefined) => (state: RootState): Record<string, any> => {
/**
* Returns `undefined` when the members for `billingId` have not been fetched (or the fetch failed) —
* callers must handle it. Note the `!billingId` branch below predates this and returns `{}` instead;
* that inconsistency is left alone rather than widened here.
*
* Deliberately NOT defaulted to `{}`, because BillingTeamMembers and OtherBillingTeamDetails both
* drive an antd `<Table loading={!billingTeamMembers} />`, and a truthy empty object silently swaps
* those spinners for an empty-state. A fresh `{}` per call would additionally re-render both on every
* dispatched action while members are absent; that part is avoidable with a shared constant, the
* loading-state regression is not.
*/
export const getBillingTeamMembers = (billingId: string | undefined) => (
state: RootState
): Record<string, any> | undefined => {
if (!billingId) {
return {};
}
Expand Down