[8.10] [Logs] Amend lazy imports in logs_shared plugin (#164102)#164180
Merged
kibanamachine merged 1 commit intoelastic:8.10from Aug 17, 2023
Merged
[8.10] [Logs] Amend lazy imports in logs_shared plugin (#164102)#164180kibanamachine merged 1 commit intoelastic:8.10from
kibanamachine merged 1 commit intoelastic:8.10from
Conversation
## Summary As part of elastic#161151 a [selection of component imports were made lazy](https://github.com/elastic/kibana/blob/main/x-pack/plugins/logs_shared/public/index.ts#L52) and wrapped with a [`dynamic` wrapper component](https://github.com/elastic/kibana/blob/main/x-pack/plugins/logs_shared/common/dynamic.tsx#L22). Unfortunately some of these imports did not adhere to the rules of React's `lazy` imports (needing a `default` export, no named imports etc), and the `dynamic` wrapper seems to have suppressed error information that would have been available via using `lazy` directly. Only the anomaly and categories log entry examples (in the expanded rows) were affected by this, as the stream and embeddable import from locations that were backed by a `default` export (and those top level components don't import from that particular index file lower in the hierarchy). For imports that weren't backed by a `default` I've added them, and where necessary moved components to new files if needed (since it's one `default` per file). Also open to suggestions of ways we can alter the `<dynamic />` component and maintain the error safety 🤔 ## Examples Without these changes:  Warning using `lazy` directly without the `dynamic` wrapper:  ## Testing - Check all instances render correctly (stream, embeddable uses, and ML page log entry examples). (cherry picked from commit a96785c)
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsasync chunk count
ESLint disabled line counts
Total ESLint disabled count
To update your PR or re-run it, just comment with: cc @Kerry350 |
This was referenced Oct 1, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto8.10:Questions ?
Please refer to the Backport tool documentation