@@ -19,6 +19,7 @@ import { DropdownTabButton, TabButton, TabWrapper } from '../../components/tabs'
1919import { ReportLayout } from '../reports/report-layout'
2020import { ReportHeader } from '../reports/report-header'
2121import MoreLink from '../more-link'
22+ import { MoreLinkState } from '../more-link-state'
2223import { Pill } from '../../components/pill'
2324import * as api from '../../api'
2425import * as url from '../../util/url'
@@ -104,8 +105,7 @@ export default function Behaviours({ importedDataInView }) {
104105 useState ( false )
105106
106107 const [ skipImportedReason , setSkipImportedReason ] = useState ( null )
107- const [ moreLinkVisible , setMoreLinkVisible ] = useState ( true )
108- const [ moreLinkClickable , setMoreLinkClickable ] = useState ( false )
108+ const [ moreLinkState , setMoreLinkState ] = useState ( MoreLinkState . LOADING )
109109
110110 const onGoalFilterClick = useCallback ( ( e ) => {
111111 const goalName = e . target . innerHTML
@@ -140,11 +140,10 @@ export default function Behaviours({ importedDataInView }) {
140140
141141 useEffect ( ( ) => setLoading ( true ) , [ query , mode ] )
142142 useEffect ( ( ) => {
143- setMoreLinkClickable ( false )
144143 if ( mode === PROPS && ! selectedPropKey ) {
145- setMoreLinkVisible ( false )
144+ setMoreLinkState ( MoreLinkState . HIDDEN )
146145 } else {
147- setMoreLinkVisible ( true )
146+ setMoreLinkState ( MoreLinkState . LOADING )
148147 }
149148 } , [ query , mode , selectedPropKey ] )
150149
@@ -265,9 +264,9 @@ export default function Behaviours({ importedDataInView }) {
265264 setLoading ( false )
266265 setSkipImportedReason ( apiResponse . skip_imported_reason )
267266 if ( apiResponse . results && apiResponse . results . length > 0 ) {
268- setMoreLinkClickable ( true )
267+ setMoreLinkState ( MoreLinkState . READY )
269268 } else {
270- setMoreLinkVisible ( false )
269+ setMoreLinkState ( MoreLinkState . HIDDEN )
271270 }
272271 }
273272
@@ -577,8 +576,7 @@ export default function Behaviours({ importedDataInView }) {
577576 { renderImportedQueryUnsupportedWarning ( ) }
578577 </ div >
579578 < MoreLink
580- visible = { moreLinkVisible }
581- clickable = { moreLinkClickable }
579+ state = { moreLinkState }
582580 linkProps = { moreLinkProps ( ) }
583581 />
584582 </ ReportHeader >
0 commit comments