Skip to content

Commit

Permalink
[8.x] [dashboard] do not async import dashboard actions on plugin load (
Browse files Browse the repository at this point in the history
#195616) (#195655)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[dashboard] do not async import dashboard actions on plugin load
(#195616)](#195616)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-09T17:21:15Z","message":"[dashboard]
do not async import dashboard actions on plugin load (#195616)\n\nPart
of https://github.com/elastic/kibana/issues/194171\r\n\r\nNotice in the
screen shot below, how opening Kibana home page loads\r\nasync dashboard
chunks.\r\n<img width=\"500\" alt=\"Screenshot 2024-10-09 at 8 38
24 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/2cfdb512-03e4-4634-bb0c-a8d163f98540\">\r\n\r\nThis
PR replaces async import with a sync import. The page load
bundle\r\nsize increases but this is no different than the current
behavior, just\r\nthe import is now properly accounted for in page load
stats. The next\r\nstep is to resolve
#191642 and\r\nreduce the page
load impact of registering uiActions (but this is out of\r\nscope for
this
PR).","sha":"7448376119aa1aad0888eb68449c1b15fd0852ac","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","v9.0.0","v8.16.0","backport:version"],"title":"[dashboard]
do not async import dashboard actions on plugin
load","number":195616,"url":"https://github.com/elastic/kibana/pull/195616","mergeCommit":{"message":"[dashboard]
do not async import dashboard actions on plugin load (#195616)\n\nPart
of https://github.com/elastic/kibana/issues/194171\r\n\r\nNotice in the
screen shot below, how opening Kibana home page loads\r\nasync dashboard
chunks.\r\n<img width=\"500\" alt=\"Screenshot 2024-10-09 at 8 38
24 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/2cfdb512-03e4-4634-bb0c-a8d163f98540\">\r\n\r\nThis
PR replaces async import with a sync import. The page load
bundle\r\nsize increases but this is no different than the current
behavior, just\r\nthe import is now properly accounted for in page load
stats. The next\r\nstep is to resolve
#191642 and\r\nreduce the page
load impact of registering uiActions (but this is out of\r\nscope for
this
PR).","sha":"7448376119aa1aad0888eb68449c1b15fd0852ac"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195616","number":195616,"mergeCommit":{"message":"[dashboard]
do not async import dashboard actions on plugin load (#195616)\n\nPart
of https://github.com/elastic/kibana/issues/194171\r\n\r\nNotice in the
screen shot below, how opening Kibana home page loads\r\nasync dashboard
chunks.\r\n<img width=\"500\" alt=\"Screenshot 2024-10-09 at 8 38
24 AM\"\r\nsrc=\"https://github.com/user-attachments/assets/2cfdb512-03e4-4634-bb0c-a8d163f98540\">\r\n\r\nThis
PR replaces async import with a sync import. The page load
bundle\r\nsize increases but this is no different than the current
behavior, just\r\nthe import is now properly accounted for in page load
stats. The next\r\nstep is to resolve
#191642 and\r\nreduce the page
load impact of registering uiActions (but this is out of\r\nscope for
this
PR).","sha":"7448376119aa1aad0888eb68449c1b15fd0852ac"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <[email protected]>
  • Loading branch information
kibanamachine and nreese authored Oct 9, 2024
1 parent 95ebd3a commit 884b861
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 884b861

Please sign in to comment.