Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Oct 29, 2022
1 parent d74ab22 commit 43c06f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ export function useDiscoverState({
savedSearch.searchSource,
services.toastNotifications
);
stateContainer.actions.setDataView(nextDataView);

// If the requested data view is not found, don't try to load it,
// and instead reset the app state to the fallback data view
Expand All @@ -211,6 +210,7 @@ export function useDiscoverState({
}
savedSearch.searchSource.setField('index', nextDataView);
reset();
stateContainer.actions.setDataView(nextDataView);
}

if (chartDisplayChanged || chartIntervalChanged || docTableSortChanged) {
Expand All @@ -226,7 +226,7 @@ export function useDiscoverState({
refetch$,
data$,
reset,
savedSearch.searchSource,
savedSearch,
replaceUrlAppState,
stateContainer,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export function getDiscoverStateContainer({
setState(appStateContainerModified, { index: dataView.id });
}
// sync initial app filters from state to filterManager
const filters = appStateContainer.getState().filters;
const filters = appStateContainer.getState().filters || [];
if (filters) {
filterManager.setAppFilters(cloneDeep(filters));
}
Expand Down
3 changes: 1 addition & 2 deletions x-pack/test/functional/apps/discover/saved_searches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern('ecommerce');
await filterBar.addFilter('category', 'is', `Men's Shoes`);
await queryBar.setQuery('customer_gender:MALE');
await queryBar.submitQuery();

await PageObjects.discover.saveSearch('test-unselect-saved-search');

await queryBar.submitQuery();

expect(await filterBar.hasFilter('category', `Men's Shoes`)).to.be(true);
expect(await queryBar.getQueryString()).to.eql('customer_gender:MALE');

Expand Down

0 comments on commit 43c06f9

Please sign in to comment.