Skip to content

Commit 88cc3f9

Browse files
authored
Merge pull request #4078 from ProjectMirador/prop-bool-warning
Correct propType to return expected Boolean
2 parents 6c5204c + 368110e commit 88cc3f9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/containers/WindowSideBarButtons.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)