Commit 62bd3217 authored by Hannah Stepanek's avatar Hannah Stepanek

Specify particular store states that are needed

parent a22aef07
...@@ -22,15 +22,23 @@ const countVisibleAnns = annThread => { ...@@ -22,15 +22,23 @@ const countVisibleAnns = annThread => {
* any search results were found. * any search results were found.
* */ * */
function SearchStatusBar({ rootThread }) { function SearchStatusBar({ rootThread }) {
const storeState = useStore(store => store.getState()); const {
directLinkedGroupFetchFailed,
filterQuery,
selectedAnnotationMap,
selectedTab,
} = useStore(store => ({
directLinkedGroupFetchFailed: store.getState().directLinkedGroupFetchFailed,
filterQuery: store.getState().filterQuery,
selectedAnnotationMap: store.getState().selectedAnnotationMap,
selectedTab: store.getState().selectedTab,
}));
const clearSelection = useStore(store => store.clearSelection); const clearSelection = useStore(store => store.clearSelection);
const filterQuery = storeState.filterQuery; const filterActive = !!filterQuery;
const filterActive = !!storeState.filterQuery;
const annotationCount = useStore(store => store.annotationCount()); const annotationCount = useStore(store => store.annotationCount());
const noteCount = useStore(store => store.noteCount()); const noteCount = useStore(store => store.noteCount());
const selectedTab = storeState.selectedTab;
const thread = rootThread.thread(storeState); const thread = useStore(store => rootThread.thread(store.getState()));
const visibleCount = useMemo(() => { const visibleCount = useMemo(() => {
return countVisibleAnns(thread); return countVisibleAnns(thread);
...@@ -49,10 +57,10 @@ function SearchStatusBar({ rootThread }) { ...@@ -49,10 +57,10 @@ function SearchStatusBar({ rootThread }) {
}; };
const areNotAllAnnotationsVisible = () => { const areNotAllAnnotationsVisible = () => {
if (storeState.directLinkedGroupFetchFailed) { if (directLinkedGroupFetchFailed) {
return true; return true;
} }
const selection = storeState.selectedAnnotationMap; const selection = selectedAnnotationMap;
if (!selection) { if (!selection) {
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment