@@ -32,6 +32,7 @@ export const Organizations = ({pendingApproval, tab}) => {
3232
3333 const [ refresh , setRefresh ] = useState ( new Date ( ) ) ;
3434 const [ searching , setSearching ] = useState ( false ) ;
35+ const [ sortedBy , setSortedBy ] = useState ( "DESC" ) ;
3536 const [ paginationQueryParams , setPaginationQueryParams ] = useState ( defaultPagination ( "createdAt" , "DESC" ) ) ;
3637 const [ totalElements , setTotalElements ] = useState ( 0 ) ;
3738 const [ organizations , setOrganizations ] = useState ( [ ] ) ;
@@ -47,7 +48,6 @@ export const Organizations = ({pendingApproval, tab}) => {
4748 if ( pendingApproval ) {
4849 pendingApprovalOrganizations ( ) . then ( res => {
4950 setOrganizations ( res ) ;
50- setLoading ( false ) ;
5151 } )
5252 } else {
5353 searchOrganizations ( paginationQueryParams )
@@ -58,7 +58,7 @@ export const Organizations = ({pendingApproval, tab}) => {
5858 } ) ;
5959 }
6060 } ,
61- [ refresh , paginationQueryParams , tab ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
61+ [ refresh , paginationQueryParams ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
6262
6363 useEffect ( ( ) => {
6464 if ( inputRef . current ) {
@@ -67,9 +67,11 @@ export const Organizations = ({pendingApproval, tab}) => {
6767 } , [ openOrganizationId ] ) ;
6868
6969 const search = ( query , sorted , reverse , page ) => {
70- const isSortReversed = paginationQueryParams . sortDirection !== "DESC" ;
71- const paginationQueryParamsChanged = sorted !== paginationQueryParams . sort || reverse !== isSortReversed ||
70+ const newSorted = reverse ? "ASC" : "DESC" ;
71+ const isReverseChanged = sortedBy !== newSorted ;
72+ const paginationQueryParamsChanged = sorted !== paginationQueryParams . sort || isReverseChanged ||
7273 page !== paginationQueryParams . pageNumber ;
74+ setSortedBy ( newSorted ) ;
7375 if ( ( ! isEmpty ( query ) && query . trim ( ) . length > 2 ) || paginationQueryParamsChanged ) {
7476 delayedAutocomplete ( query , sorted , reverse , page ) ;
7577 }
@@ -254,14 +256,9 @@ export const Organizations = ({pendingApproval, tab}) => {
254256 mapper : org => < div className = "wrapper" > < Checkbox value = { ! isEmpty ( org . manageIdentifier ) } disabled = { true } /> </ div >
255257 } ,
256258 {
257- key : "applicationCount" ,
258- header : I18n . t ( "organizations.applicationCount" ) ,
259- mapper : org => org . applicationCount
260- } ,
261- {
262- key : "memberCount" ,
263- header : I18n . t ( "organizations.memberCount" ) ,
264- mapper : org => org . memberCount
259+ key : "adminEmail" ,
260+ header : I18n . t ( "organizations.adminEmail" ) ,
261+ mapper : org => org . adminEmail
265262 } ,
266263 {
267264 key : "createdAt" ,
0 commit comments