From 83d62c152ce93260f1fcf59879c3204947015327 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 9 Oct 2024 11:21:15 -0600 Subject: [PATCH] [dashboard] do not async import dashboard actions on plugin load (#195616) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of https://github.com/elastic/kibana/issues/194171 Notice in the screen shot below, how opening Kibana home page loads async dashboard chunks. Screenshot 2024-10-09 at 8 38 24 AM This PR replaces async import with a sync import. The page load bundle size increases but this is no different than the current behavior, just the import is now properly accounted for in page load stats. The next step is to resolve https://github.com/elastic/kibana/issues/191642 and reduce the page load impact of registering uiActions (but this is out of scope for this PR). (cherry picked from commit 7448376119aa1aad0888eb68449c1b15fd0852ac) --- src/plugins/dashboard/public/plugin.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 0957bf9364524..b7a920eb08ce3 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -78,6 +78,7 @@ import { } from './dashboard_container/panel_placement'; import type { FindDashboardsService } from './services/dashboard_content_management_service/types'; import { setKibanaServices, untilPluginStartServicesReady } from './services/kibana_services'; +import { buildAllDashboardActions } from './dashboard_actions'; export interface DashboardFeatureFlagConfig { allowByValueEmbeddables: boolean; @@ -322,14 +323,12 @@ export class DashboardPlugin public start(core: CoreStart, plugins: DashboardStartDependencies): DashboardStart { setKibanaServices(core, plugins); - Promise.all([import('./dashboard_actions'), untilPluginStartServicesReady()]).then( - ([{ buildAllDashboardActions }]) => { - buildAllDashboardActions({ - plugins, - allowByValueEmbeddables: this.dashboardFeatureFlagConfig?.allowByValueEmbeddables, - }); - } - ); + untilPluginStartServicesReady().then(() => { + buildAllDashboardActions({ + plugins, + allowByValueEmbeddables: this.dashboardFeatureFlagConfig?.allowByValueEmbeddables, + }); + }); return { locator: this.locator,