Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Render the sidebar even if documents fetching failed #147179

Merged
merged 4 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ export function DiscoverSidebarResponsive(props: DiscoverSidebarResponsiveProps)
},
});
break;
case FetchStatus.ERROR:
dispatchSidebarStateAction({
type: DiscoverSidebarReducerActionType.DOCUMENTS_LOADED,
payload: {
dataView: selectedDataViewRef.current,
fieldCounts: {},
isPlainRecord: isPlainRecordType,
},
});
break;
default:
break;
}
Expand Down
40 changes: 40 additions & 0 deletions test/functional/apps/discover/group1/_sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,46 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(allFields.includes('_bytes-runtimefield')).to.be(false);
});

it('should render even when retrieving documents failed with an error', async () => {
await PageObjects.header.waitUntilLoadingHasFinished();

await testSubjects.missingOrFail('discoverNoResultsError');

expect(await PageObjects.discover.getSidebarAriaDescription()).to.be(
'53 available fields. 0 empty fields. 3 meta fields.'
);

await PageObjects.discover.addRuntimeField('_invalid-runtimefield', `emit(‘’);`);

await PageObjects.header.waitUntilLoadingHasFinished();

// error in fetching documents because of the invalid runtime field
await testSubjects.existOrFail('discoverNoResultsError');

await PageObjects.discover.waitUntilSidebarHasLoaded();

// check that the sidebar is rendered
expect(await PageObjects.discover.getSidebarAriaDescription()).to.be(
'54 available fields. 0 empty fields. 3 meta fields.'
);
let allFields = await PageObjects.discover.getAllFieldNames();
expect(allFields.includes('_invalid-runtimefield')).to.be(true);

await browser.refresh();
await PageObjects.header.waitUntilLoadingHasFinished();
await testSubjects.existOrFail('discoverNoResultsError'); // still has error

// check that the sidebar is rendered event after a refresh
allFields = await PageObjects.discover.getAllFieldNames();
expect(allFields.includes('_invalid-runtimefield')).to.be(true);

await PageObjects.discover.removeField('_invalid-runtimefield');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSidebarHasLoaded();

await testSubjects.missingOrFail('discoverNoResultsError');
});

it('should work correctly when time range is updated', async function () {
await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/index_pattern_without_timefield'
Expand Down