@@ -18,7 +18,7 @@ import Mappings from './Mappings'
1818import Concept from './Concept'
1919import IncludeRetired from './IncludeRetired'
2020
21- const CandidateList = ( { candidates, header, rowIndex, orderBy, order, onOrderChange, setShowItem, showItem, setShowHighlights, isSelectedForMap, onMap, onFetchMore, canFetchMore} ) => {
21+ const CandidateList = ( { candidates, header, rowIndex, orderBy, order, onOrderChange, setShowItem, showItem, setShowHighlights, isSelectedForMap, onMap, onFetchMore, canFetchMore, isLoading } ) => {
2222 const results = { total : onFetchMore ? candidates . length : 1 , results : candidates || [ ] }
2323
2424 return candidates . length > 0 ? (
@@ -73,8 +73,8 @@ const CandidateList = ({candidates, header, rowIndex, orderBy, order, onOrderCha
7373 {
7474 onFetchMore && canFetchMore &&
7575 < div className = 'col-xs-12' style = { { textAlign : 'right' , margin : '16px 0' } } >
76- < Button size = 'small' variant = 'text' sx = { { textTransform : 'none' } } onClick = { onFetchMore } >
77- Fetch More
76+ < Button disabled = { isLoading } size = 'small' variant = 'text' sx = { { textTransform : 'none' } } onClick = { onFetchMore } >
77+ { isLoading ? 'Fetching...' : ' Fetch More' }
7878 </ Button >
7979 </ div >
8080 }
@@ -96,7 +96,8 @@ const Candidates = ({rowIndex, alert, setAlert, candidates, orderBy, order, onOr
9696 order : order ,
9797 onOrderChange : onOrderChange ,
9898 setShowItem : setShowItem ,
99- showItem : showItem
99+ showItem : showItem ,
100+ isLoading : isLoading
100101 }
101102 return (
102103 < div className = 'col-xs-12 padding-0' >
@@ -133,17 +134,18 @@ const Candidates = ({rowIndex, alert, setAlert, candidates, orderBy, order, onOr
133134 '& ul' : { padding : 0 } ,
134135 } }
135136 subheader = { < li /> }
137+ id = 'candidates-list'
136138 >
137139 < li >
138140 {
139- isLoading ?
141+ ( isLoading && ! recommended ?. length ) ?
140142 < Skeleton height = { 60 } /> :
141143 < CandidateList { ...props } candidates = { recommended } header = 'Recommended Candidates' canFetchMore = { canFetchMore && ! available ?. length } onFetchMore = { onFetchMore } />
142144 }
143145 </ li >
144146 < li >
145147 {
146- isLoading ?
148+ ( isLoading && ! available ?. length ) ?
147149 < Skeleton height = { 60 } /> :
148150 < CandidateList { ...props } candidates = { available } header = 'Available Candidates' canFetchMore = { canFetchMore } onFetchMore = { onFetchMore } />
149151 }
0 commit comments