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

load react component lazily to reduce entry bundle #65267

Merged

Conversation

mshustov
Copy link
Contributor

@mshustov mshustov commented May 5, 2020

Summary

Parent issue: #62263
We strive to keep the entry bundle as small as possible to speed up Kibana load + bootstrap time.
telemetry_management_section.plugin.js bundle is loaded whenever a user opens Kibana and should be lightweight. This PR adds lazy loading to reduce telemetry_management_section.plugin.js bundle size to load the main chunk of code by demand when the section is mounted.
telemetry_management_section.plugin.js size before: 966Kb
telemetry_management_section.plugin.js size after: 8.7Kb

@mshustov mshustov added chore performance release_note:skip Skip the PR/issue when compiling release notes v7.8.0 labels May 5, 2020
@mshustov mshustov marked this pull request as ready for review May 5, 2020 13:54
@mshustov mshustov requested a review from a team as a code owner May 5, 2020 13:54
Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

LGTM! I tested locally and it works fine.

Just added 1 super NIT.


// required for lazy loading
// eslint-disable-next-line import/no-default-export
export { TelemetryManagementSection as default };
Copy link
Member

Choose a reason for hiding this comment

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

Super NIT: why the export { X as Y } instead of the straight export default TelemetryManagementSection; format?

Suggested change
export { TelemetryManagementSection as default };
export default TelemetryManagementSection;

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@mshustov mshustov merged commit 52a232f into elastic:master May 5, 2020
@mshustov mshustov deleted the lazy-loading-telemetry_management_section branch May 5, 2020 17:55
mshustov added a commit to mshustov/kibana that referenced this pull request May 5, 2020
* load react component lazily to reduce entry bundle

* address comments
mshustov added a commit that referenced this pull request May 5, 2020
* load react component lazily to reduce entry bundle

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore performance release_note:skip Skip the PR/issue when compiling release notes v7.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants