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

Refresh index pattern list before redirecting #63329

Merged
merged 14 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 11 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
3 changes: 3 additions & 0 deletions src/legacy/core_plugins/kibana/public/discover/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ export class DiscoverPlugin implements Plugin<void, void> {
await this.initializeServices();
await this.initializeInnerAngular();

// make sure the index pattern list is up to date
const [, { data: dataStart }] = await core.getStartServices();
await dataStart.indexPatterns.clearCache();
const { renderApp } = await import('./np_ready/application');
const unmount = await renderApp(innerAngularName, params.element);
return () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ uiModules

Promise.resolve($scope.indexPattern.destroy())
.then(function() {
npStart.plugins.data.indexPatterns.clearCache();
$location.url('/management/kibana/index_patterns');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better if we clear the index pattern cache upon arrival to management?
Otherwise, if we get to that route from a different path, we'll have different behaviors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just realizing we don't even need this clear cache to fix the bug because it already gets cleared when switching over to discover.

The index pattern listing in management is not affected by this because it's using the raw saved object client.

I will just revert this line.

})
.catch(fatalError);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ export class DashboardPlugin
localStorage: new Storage(localStorage),
usageCollection,
};
// make sure the index pattern list is up to date
await dataStart.indexPatterns.clearCache();
const { renderApp } = await import('./application/application');
const unmount = renderApp(params.element, params.appBasePath, deps);
return () => {
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/visualize/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export class VisualizePlugin
};
setServices(deps);

// make sure the index pattern list is up to date
await pluginsStart.data.indexPatterns.clearCache();
const { renderApp } = await import('./application/application');
const unmount = renderApp(params.element, params.appBasePath, deps);
return () => {
Expand Down
2 changes: 2 additions & 0 deletions test/functional/page_objects/dashboard_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide

public async clickNewDashboard() {
await listingTable.clickNewButton('createDashboardPromptButton');
// make sure the dashboard page is shown
await this.waitForRenderComplete();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When switching to a dashboard, we introduce an additional delay with this change because another network roundtrip is necessary. This stabilizes the test so it doesn't fail.

}

public async clickCreateDashboardPrompt() {
Expand Down