Unverified Commit eb8c3492 authored by Kyle Keating's avatar Kyle Keating Committed by GitHub

Fix <SearchStatusBar> flicker (#2271)

Don’t hide the component when `store.isLoading()` is true. This only causes a re-render of that component and momentarily removes it from the DOM. Its not actually invalid to show the filter buttons while loading because the filter is still being applied.
parent 9b5c2031
...@@ -76,7 +76,6 @@ function SidebarContent({ ...@@ -76,7 +76,6 @@ function SidebarContent({
hasDirectLinkedAnnotationError || hasDirectLinkedGroupError; hasDirectLinkedAnnotationError || hasDirectLinkedGroupError;
const showTabs = !hasContentError && !hasAppliedFilter; const showTabs = !hasContentError && !hasAppliedFilter;
const showSearchStatus = !hasContentError && !isLoading;
// Show a CTA to log in if successfully viewing a direct-linked annotation // Show a CTA to log in if successfully viewing a direct-linked annotation
// and not logged in // and not logged in
...@@ -139,7 +138,7 @@ function SidebarContent({ ...@@ -139,7 +138,7 @@ function SidebarContent({
<SidebarContentError errorType="group" onLoginRequest={onLogin} /> <SidebarContentError errorType="group" onLoginRequest={onLogin} />
)} )}
{showTabs && <SelectionTabs isLoading={isLoading} />} {showTabs && <SelectionTabs isLoading={isLoading} />}
{showSearchStatus && <SearchStatusBar />} {!hasContentError && <SearchStatusBar />}
<ThreadList thread={rootThread} /> <ThreadList thread={rootThread} />
{showLoggedOutMessage && <LoggedOutMessage onLogin={onLogin} />} {showLoggedOutMessage && <LoggedOutMessage onLogin={onLogin} />}
</div> </div>
......
...@@ -169,9 +169,13 @@ describe('SidebarContent', () => { ...@@ -169,9 +169,13 @@ describe('SidebarContent', () => {
it('does not render tabs', () => { it('does not render tabs', () => {
const wrapper = createComponent(); const wrapper = createComponent();
assert.isFalse(wrapper.find('SelectionTabs').exists()); assert.isFalse(wrapper.find('SelectionTabs').exists());
}); });
it('does not render search status', () => {
const wrapper = createComponent();
assert.isFalse(wrapper.find('SearchStatusBar').exists());
});
}); });
}); });
...@@ -194,9 +198,13 @@ describe('SidebarContent', () => { ...@@ -194,9 +198,13 @@ describe('SidebarContent', () => {
it('does not render tabs', () => { it('does not render tabs', () => {
const wrapper = createComponent(); const wrapper = createComponent();
assert.isFalse(wrapper.find('SelectionTabs').exists()); assert.isFalse(wrapper.find('SelectionTabs').exists());
}); });
it('does not render search status', () => {
const wrapper = createComponent();
assert.isFalse(wrapper.find('SearchStatusBar').exists());
});
}); });
describe('streamer', () => { describe('streamer', () => {
...@@ -224,23 +232,11 @@ describe('SidebarContent', () => { ...@@ -224,23 +232,11 @@ describe('SidebarContent', () => {
assert.isTrue(wrapper.find('FocusedModeHeader').exists()); assert.isTrue(wrapper.find('FocusedModeHeader').exists());
}); });
it('renders search status', () => { it('renders the search status', () => {
fakeStore.hasFetchedAnnotations.returns(true);
fakeStore.isLoading.returns(false);
const wrapper = createComponent(); const wrapper = createComponent();
assert.isTrue(wrapper.find('SearchStatusBar').exists()); assert.isTrue(wrapper.find('SearchStatusBar').exists());
}); });
it('does not render search status if annotations are loading', () => {
fakeStore.isLoading.returns(true);
const wrapper = createComponent();
assert.isFalse(wrapper.find('SearchStatusBar').exists());
});
describe('selection tabs', () => { describe('selection tabs', () => {
it('renders tabs', () => { it('renders tabs', () => {
const wrapper = createComponent(); const wrapper = createComponent();
......
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