@@ -15,7 +15,8 @@ import {
1515 getQuickOpenType ,
1616 getSelectedSource ,
1717 getSymbols ,
18- getTabs
18+ getTabs ,
19+ isSymbolsLoading
1920} from "../selectors" ;
2021import { scrollList } from "../utils/result-list" ;
2122import {
@@ -46,6 +47,7 @@ type Props = {
4647 query : string ,
4748 searchType : QuickOpenType ,
4849 symbols : FormattedSymbolDeclarations ,
50+ symbolsLoading : boolean ,
4951 tabs : string [ ] ,
5052 selectLocation : Location => void ,
5153 setQuickOpenQuery : ( query : string ) => void ,
@@ -362,8 +364,18 @@ export class QuickOpenModal extends Component<Props, State> {
362364 return ! this . getResultCount ( ) && ! ! query ;
363365 }
364366
367+ renderLoading = ( ) = > {
368+ const { symbolsLoading } = this . props ;
369+
370+ if ( ( this . isFunctionQuery ( ) || this . isVariableQuery ( ) ) && symbolsLoading ) {
371+ return (
372+ < div className = "loading-indicator" > { L10N . getStr ( "loadingText" ) } </ div >
373+ ) ;
374+ }
375+ } ;
376+
365377 render ( ) {
366- const { enabled , query , symbols } = this . props ;
378+ const { enabled, query } = this . props ;
367379 const { selectedIndex , results } = this . state ;
368380
369381 if ( ! enabled ) {
@@ -388,12 +400,7 @@ export class QuickOpenModal extends Component<Props, State> {
388400 expanded && items [ selectedIndex ] ? items [ selectedIndex ] . id : ""
389401 }
390402 />
391- { ! symbols ||
392- ( symbols . functions . length == 0 && (
393- < div className = "loading-indicator" >
394- { L10N . getStr ( "loadingText" ) }
395- </ div >
396- ) ) }
403+ { this . renderLoading ( ) }
397404 { newResults && (
398405 < ResultList
399406 key = "results"
@@ -413,16 +420,13 @@ export class QuickOpenModal extends Component<Props, State> {
413420/* istanbul ignore next: ignoring testing of redux connection stuff */
414421function mapStateToProps ( state ) {
415422 const selectedSource = getSelectedSource ( state ) ;
416- let symbols = null ;
417- if ( selectedSource != null ) {
418- symbols = getSymbols ( state , selectedSource . toJS ( ) ) ;
419- }
420423
421424 return {
422425 enabled : getQuickOpenEnabled ( state ) ,
423426 sources : formatSources ( getSources ( state ) ) ,
424427 selectedSource ,
425- symbols : formatSymbols ( symbols ) ,
428+ symbols : formatSymbols ( getSymbols ( state , selectedSource ) ) ,
429+ symbolsLoading : isSymbolsLoading ( state , selectedSource ) ,
426430 query : getQuickOpenQuery ( state ) ,
427431 searchType : getQuickOpenType ( state ) ,
428432 tabs : getTabs ( state ) . toArray ( )
0 commit comments