Skip to content

Commit f414a3c

Browse files
committed
Small ts warning fix
1 parent 4c0e73e commit f414a3c

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

frontend/src/components/OrganizationMemberList.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react'
2-
import { State } from '../store'
32
import { useSelector } from 'react-redux'
43
import { selectAvailableUsers } from '../selectors/organizations'
54
import { OrganizationMember } from '../components/OrganizationMember'
@@ -9,7 +8,7 @@ import { List } from '@mui/material'
98
type Props = { organization?: IOrganizationState; owner?: IOrganizationMember; enterprise?: boolean }
109

1110
export const OrganizationMemberList: React.FC<Props> = ({ organization, owner, enterprise }) => {
12-
const freeUsers = useSelector((state: State) => selectAvailableUsers(state))
11+
const freeUsers = useSelector(selectAvailableUsers)
1312
const members = organization?.members ? [...organization.members].sort(alphaEmailSort) : []
1413
return (
1514
<List>

frontend/src/pages/OrganizationAddPage.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@ import { Title } from '../components/Title'
1414
import { useHistory } from 'react-router-dom'
1515

1616
export const OrganizationAddPage = () => {
17-
const { contacts, organization, freeUsers } = useSelector((state: State) => {
18-
const organization = selectOrganization(state)
19-
return {
20-
organization,
21-
contacts: state.contacts.all.filter(c => !organization.members.find(s => s.user.id === c.id)) || [],
22-
freeUsers: selectAvailableUsers(state),
23-
}
24-
})
17+
const organization = useSelector(selectOrganization)
18+
const allContacts = useSelector((state: State) => state.contacts.all)
19+
const freeUsers = useSelector(selectAvailableUsers)
20+
const contacts = allContacts.filter(c => !organization.members.find(s => s.user.id === c.id)) || []
2521

2622
const [emails, setEmails] = React.useState<string[]>([])
2723
const [roleId, setRoleId] = React.useState<IOrganizationRoleIdType>(

frontend/src/selectors/organizations.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ export const selectLimits = createSelector([selectOrganization], (organization):
8080
return organization.limits || []
8181
})
8282

83-
// export const selectResellerLimits = createSelector(
84-
// [selectOrganization, optionalCustomerId],
85-
// (organization, customerId): ILimit[] => organization.reseller?.customers.find(c => c.id === customerId)?.limits || []
86-
// )
87-
8883
export const selectLimit = createSelector(
8984
[selectLimits, optionalSecondParam],
9085
(limits, limitName): ILimit | undefined => limits.find(limit => limit.name === limitName)
@@ -136,5 +131,5 @@ export const selectOwner = createSelector(
136131

137132
export const selectAvailableUsers = createSelector(
138133
[state => selectLimit(state, undefined, 'org-users')],
139-
(limit): number => Math.max(limit?.value - limit?.actual, 0)
134+
(limit): number => Math.max(limit?.value - limit?.actual || -1, 0)
140135
)

0 commit comments

Comments
 (0)