[data.ui] Lazy load UI components in data plugin.#78889
[data.ui] Lazy load UI components in data plugin.#78889lukeelmers merged 12 commits intoelastic:masterfrom
Conversation
69fed12 to
d003dfe
Compare
There was a problem hiding this comment.
These cleanups should no longer be needed as explained in #78742
src/plugins/data/public/ui/index.ts
Outdated
There was a problem hiding this comment.
data/public/index.ts imports from this file, so I have removed any items which are imported internally by other lazy-loaded components. This way the only items available in ui/index are types, or lazy-loaded components.
There was a problem hiding this comment.
waitFor already fails if the items you are querying for don't exist, so we no longer need the assertions that were here previously.
There was a problem hiding this comment.
TBH I have no clue how this test worked previously with the .filterBar class... I couldn't find it anywhere in the DOM. So I replaced it with .globalFilterBar which definitely exists 🙂
There was a problem hiding this comment.
React.Suspense doesn't play nice with Enzyme, but I wanted to avoid re-writing each test with @testing-library/react since I'm not familiar with this area of code. So I made this wrapper which ensures the SearchBar that's loaded with React.lazy is available before Enzyme mount is called.
You may want to consider a rewrite with @testing-library/react that doesn't rely on <SearchBar /> internals, as it should speed these tests up a bit. (Or perhaps a functional test if you really want to test the end-to-end experience).
d003dfe to
3ee8d4d
Compare
|
Pinging @elastic/kibana-app-arch (Team:AppArch) |
|
After several attempts, I've been unable to reproduce these failures locally, however they are failing consistently so I'll keep investigating. |
mattkime
left a comment
There was a problem hiding this comment.
Changes look good and work well locally. Nice work!
|
I haven't had any luck getting to the bottom of this failed maps functional test, so I've pinged @elastic/kibana-gis for input: Since this test doesn't appear to have been failing on other branches lately, I'm trying to figure out what I changed that might have affected this test. The two components which are now lazy loaded that I could find usage of in the maps app are One hypothesis I had was that perhaps the I did a few things to try to reproduce the failure locally:
In all cases I was still unable to reproduce the failure 🙁 The screenshot from the test artifacts doesn't show any obvious rendering problems either: At this point I've adjusted the height of the But if this next run still fails, I might need some more expertise from @elastic/kibana-gis. |
3ee8d4d to
9f98cd8
Compare
9f98cd8 to
acda6d9
Compare
| // Allow a range of hits to account for variances in browser window size. | ||
| expect(parseInt(hits)).to.be.within(30, 40); |
There was a problem hiding this comment.
Discussed with @nreese, and he agreed that in this case it would be fine to make this assertion a range of values to account for small variances in screen size.
💚 Build SucceededMetrics [docs]@kbn/optimizer bundle module count
async chunks size
distributable file count
page load bundle size
History
To update your PR or re-run it, just comment with: |
nreese
left a comment
There was a problem hiding this comment.
maps changes LGTM
code review
…into feature/task_manager_429 * 'feature/task_manager_429' of github.com:elastic/kibana: (158 commits) Add license check to direct package upload handler. (#79653) [Ingest Manager] Rename API /api/ingest_manager => /api/fleet (#79193) [Security Solution][Resolver] Simplify CopyableField styling and add comments (#79594) Fine-tunes ML related text on Metrics UI (#79425) [ML] DF Analytics creation wizard: ensure job creation possible when model memory lower than estimate (#79229) Add new "Add Data" tutorials (#77237) Update APM telemetry docs (#79583) Revert "Add support for runtime field types to mappings editor. (#77420)" (#79611) Kibana request headers (#79218) ensure missing indexPattern error is bubbled up to error callout (#79378) Missing space fix (#79585) remove duplicate tab states (#79501) [data.ui] Lazy load UI components in data plugin. (#78889) Add generic type params to search dependency. (#79608) [Ingest Manager] Internal action for policy reassign (#78493) [ILM] Add index_codec to forcemerge action in hot and warm phases (#78175) [Ingest Manager] Update open API spec and add condition to agent upgrade endpoint (#79579) [ML] Hide Data Grid column options when histogram charts are enabled. (#79459) [Telemetry] Synchronous `setup` and `start` methods (#79457) [Observability] Persist time range across apps (#79258) ...

In an effort to reduce the initial bundle size of the
dataplugin, this updates items exported fromdata/public/uito be lazy-loaded.There's more we could investigate in the data plugin longer term, but this is the quickest/easiest target for bundle size reduction that doesn't involve breaking any service contracts or making lifecycle methods async.
Here are the before and after stats from webpack-bundle-analyzer:
Before:
data/public/ui~307kData Plugin


Closeup of
data/public/uiAfter:
data/public/ui~37kData Plugin


Closeup of
data/public/ui