@@ -41,6 +41,15 @@ function hasAnnotations(canvases) {
4141 } ) ;
4242}
4343
44+ /** */
45+ function hasSearchResults ( state , { windowId } ) {
46+ const { suggestedSearches } = getWindow ( state , { windowId } ) ;
47+ const companionWindowId = getCompanionWindowsForPosition ( state , { position : 'left' , windowId } ) ?. [ 0 ] ?. id ;
48+ const searchQuery = getSearchQuery ( state , { companionWindowId, windowId } ) ;
49+
50+ return Boolean ( suggestedSearches || searchQuery ) ;
51+ }
52+
4453/**
4554 * mapStateToProps - used to hook up connect to state
4655 * @memberof WindowSideButtons
@@ -54,10 +63,7 @@ const mapStateToProps = (state, { windowId }) => ({
5463 hasAnyAnnotations : hasAnnotations ( getCanvases ( state , { windowId } ) ) ,
5564 hasAnyLayers : hasLayers ( getCanvases ( state , { windowId } ) ) ,
5665 hasCurrentLayers : hasLayers ( getVisibleCanvases ( state , { windowId } ) ) ,
57- hasSearchResults : getWindow ( state , { windowId } ) . suggestedSearches || getSearchQuery ( state , {
58- companionWindowId : ( getCompanionWindowsForPosition ( state , { position : 'left' , windowId } ) [ 0 ] || { } ) . id ,
59- windowId,
60- } ) ,
66+ hasSearchResults : hasSearchResults ( state , { windowId } ) ,
6167 hasSearchService : getManifestSearchService ( state , { windowId } ) !== null ,
6268 panels : getWindowConfig ( state , { windowId } ) . panels ,
6369 sideBarPanel : ( ( getCompanionWindowsForPosition ( state , { position : 'left' , windowId } ) ) [ 0 ] || { } ) . content ,
0 commit comments