Skip to content

[chore] Import common react-use methods in shared bundle#218640

Merged
dej611 merged 7 commits intoelastic:mainfrom
dej611:fix/dedupe-react-use
Apr 24, 2025
Merged

[chore] Import common react-use methods in shared bundle#218640
dej611 merged 7 commits intoelastic:mainfrom
dej611:fix/dedupe-react-use

Conversation

@dej611
Copy link
Copy Markdown
Contributor

@dej611 dej611 commented Apr 18, 2025

Summary

Similar to #217034, #217202 and #217467 this time applied to react-use.

This is a slightly different approach than #217034 as we're caching here only the most common/frequently used methods from the react-use library and leaving the rest to be loaded within the specific plugin chunks.

What this PR does it fundamentally:

  • adds 7.x kb to the shared bundle
  • overall the startup bundle size shrinks about 3.5 kb
  • the async bundle size shrinks of about 350 kb (mainly due to 3 imports which were targeting react-use/lib).

An alternative approach would be to just fix the async import strings in there, but I thought to it was worth it to make the long step here. Feedback appreciated.

@dej611 dej611 marked this pull request as ready for review April 23, 2025 12:06
@dej611 dej611 requested review from a team as code owners April 23, 2025 12:06
Copy link
Copy Markdown
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presentation changes LGTM
code review only

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Apr 23, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@dej611 dej611 added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Apr 23, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 24, 2025

💚 Build Succeeded

  • Buildkite Build
  • Commit: 6ddc4df
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-218640-6ddc4dfd3a46

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
advancedSettings 89 88 -1
aiops 580 571 -9
apm 1883 1876 -7
automaticImport 805 799 -6
canvas 1311 1307 -4
cases 992 986 -6
charts 167 163 -4
cloudSecurityPosture 685 671 -14
contentConnectors 404 403 -1
controls 354 347 -7
customIntegrations 41 38 -3
dashboard 648 641 -7
data 533 531 -2
datasetQuality 302 295 -7
dataViewEditor 77 75 -2
dataViewFieldEditor 150 148 -2
dataViewManagement 205 202 -3
dataVisualizer 733 722 -11
discover 1203 1189 -14
embeddableAlertsTable 270 269 -1
enterpriseSearch 1335 1204 -131
esql 188 183 -5
esqlDataGrid 421 410 -11
eventAnnotationListing 589 579 -10
exploratoryView 157 151 -6
expressionHeatmap 188 184 -4
expressionMetricVis 141 137 -4
expressionPartitionVis 212 208 -4
expressions 173 171 -2
expressionTagcloud 177 173 -4
expressionXY 253 249 -4
fieldsMetadata 45 43 -2
filesManagement 147 142 -5
fleet 1189 1183 -6
globalSearchBar 30 24 -6
graph 267 262 -5
imageEmbeddable 117 116 -1
indexManagement 659 656 -3
infra 1410 1392 -18
interactiveSetup 51 42 -9
inventory 231 224 -7
kibanaReact 226 222 -4
lens 1362 1345 -17
links 105 99 -6
logsDataAccess 14 13 -1
logsShared 341 337 -4
maps 1254 1242 -12
metricsDataAccess 242 241 -1
ml 2379 2370 -9
mockIdpPlugin 132 130 -2
monitoring 628 626 -2
observability 1286 1275 -11
observabilityAIAssistant 103 100 -3
observabilityAIAssistantApp 438 302 -136
observabilityAiAssistantManagement 382 246 -136
observabilityOnboarding 116 113 -3
observabilityShared 200 198 -2
osquery 298 296 -2
presentationPanel 118 110 -8
presentationUtil 131 127 -4
profiling 283 281 -2
reporting 128 127 -1
savedObjectsTagging 79 75 -4
searchAssistant 270 134 -136
searchIndices 333 331 -2
searchPlayground 334 330 -4
security 596 591 -5
securitySolution 7332 7320 -12
serverlessSearch 412 410 -2
sessionView 107 104 -3
share 68 67 -1
slo 1115 1102 -13
snapshotRestore 194 192 -2
spaces 237 234 -3
stackAlerts 163 160 -3
streamsApp 469 458 -11
synthetics 1185 1181 -4
transform 698 689 -9
triggersActionsUi 739 731 -8
uiActionsEnhanced 145 144 -1
unifiedDocViewer 314 311 -3
unifiedHistogram 198 193 -5
unifiedSearch 347 343 -4
uptime 776 773 -3
ux 177 172 -5
visDefaultEditor 238 231 -7
visTypeTimeseries 497 490 -7
visTypeVega 542 540 -2
visualizations 469 456 -13
wciIndexSource 16 14 -2
workchatApp 137 134 -3
total -1001

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ui-shared-deps-src 68 69 +1

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
@kbn/ui-shared-deps-src 0 1 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
advancedSettings 35.3KB 35.2KB -60.0B
aiops 444.2KB 439.4KB -4.8KB
apm 2.6MB 2.6MB -2.1KB
canvas 1.1MB 1.1MB -1.2KB
cases 1.3MB 1.3MB -3.1KB
cloudSecurityPosture 521.7KB 516.8KB -4.9KB
contentConnectors 471.5KB 470.4KB -1.1KB
controls 420.6KB 419.6KB -1.1KB
customIntegrations 82.9KB 81.9KB -1.0KB
dashboard 550.2KB 548.0KB -2.1KB
data 52.4KB 51.6KB -769.0B
datasetQuality 233.9KB 233.8KB -123.0B
dataViewEditor 42.9KB 42.2KB -767.0B
dataViewFieldEditor 158.6KB 157.8KB -767.0B
dataViewManagement 126.6KB 124.6KB -2.0KB
dataVisualizer 611.3KB 610.0KB -1.2KB
discover 958.6KB 953.4KB -5.2KB
embeddableAlertsTable 796.7KB 796.6KB -116.0B
enterpriseSearch 1.3MB 1.2MB -77.7KB
esql 243.0KB 242.2KB -841.0B
esqlDataGrid 158.1KB 155.4KB -2.7KB
eventAnnotationListing 205.9KB 204.1KB -1.8KB
exploratoryView 141.7KB 141.0KB -711.0B
filesManagement 104.4KB 102.6KB -1.8KB
fleet 1.7MB 1.7MB -1.5KB
graph 382.9KB 381.0KB -1.8KB
imageEmbeddable 50.9KB 50.7KB -203.0B
indexManagement 687.7KB 685.7KB -2.0KB
infra 1.2MB 1.2MB -1.5KB
inventory 180.8KB 178.7KB -2.1KB
lens 1.4MB 1.4MB -3.7KB
links 55.3KB 53.9KB -1.4KB
logsShared 202.0KB 200.9KB -1.1KB
maps 3.0MB 3.0MB -2.8KB
metricsDataAccess 59.6KB 59.4KB -203.0B
ml 5.3MB 5.3MB -5.4KB
monitoring 623.7KB 623.4KB -297.0B
observability 1.3MB 1.3MB -1.9KB
observabilityAIAssistant 19.7KB 19.7KB +4.0B
observabilityAIAssistantApp 240.2KB 164.6KB -75.6KB
observabilityAiAssistantManagement 84.1KB 83.9KB -124.0B
observabilityOnboarding 111.6KB 110.1KB -1.5KB
osquery 1.0MB 1.0MB -1.5KB
presentationPanel 37.9KB 37.7KB -232.0B
presentationUtil 76.5KB 76.4KB -129.0B
profiling 371.6KB 370.9KB -769.0B
reporting 52.6KB 52.4KB -205.0B
savedObjectsTagging 40.2KB 38.5KB -1.6KB
searchAssistant 165.5KB 90.9KB -74.6KB
searchIndices 180.6KB 179.7KB -826.0B
searchPlayground 207.6KB 207.2KB -409.0B
security 515.6KB 515.2KB -405.0B
securitySolution 9.1MB 9.1MB -5.1KB
serverlessSearch 347.6KB 346.8KB -826.0B
sessionView 361.4KB 359.4KB -2.0KB
slo 910.1KB 904.7KB -5.4KB
snapshotRestore 248.9KB 248.2KB -797.0B
spaces 209.4KB 209.4KB +18.0B
stackAlerts 64.1KB 63.9KB -203.0B
streamsApp 409.3KB 405.6KB -3.6KB
synthetics 955.1KB 953.1KB -2.0KB
transform 618.9KB 616.6KB -2.3KB
triggersActionsUi 1.4MB 1.4MB -3.1KB
uiActionsEnhanced 126.6KB 126.4KB -194.0B
unifiedDocViewer 212.7KB 207.7KB -5.0KB
unifiedHistogram 63.4KB 63.2KB -217.0B
unifiedSearch 351.4KB 351.3KB -90.0B
uptime 496.4KB 494.9KB -1.5KB
ux 138.6KB 135.9KB -2.7KB
visDefaultEditor 93.6KB 92.4KB -1.2KB
visTypeTimeseries 484.5KB 482.6KB -1.9KB
visTypeVega 2.0MB 2.0MB -242.0B
visualizations 340.2KB 336.0KB -4.2KB
workchatApp 93.6KB 91.6KB -1.9KB
total -345.9KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
advancedSettings 5.5KB 5.6KB +73.0B
aiops 17.3KB 17.7KB +373.0B
apm 35.2KB 35.6KB +363.0B
canvas 13.6KB 13.8KB +217.0B
cases 133.6KB 133.8KB +221.0B
cloudSecurityPosture 17.4KB 18.0KB +576.0B
contentConnectors 29.3KB 29.4KB +76.0B
controls 11.0KB 11.0KB +12.0B
customIntegrations 10.4KB 10.4KB +12.0B
dashboard 17.4KB 17.7KB +288.0B
data 400.5KB 400.6KB +72.0B
datasetQuality 20.2KB 20.3KB +69.0B
dataViewEditor 11.6KB 11.7KB +72.0B
dataViewFieldEditor 23.1KB 23.2KB +72.0B
dataViewManagement 5.8KB 5.9KB +76.0B
dataVisualizer 27.9KB 26.7KB -1.2KB
discover 20.7KB 21.5KB +790.0B
embeddableAlertsTable 4.7KB 4.8KB +71.0B
enterpriseSearch 38.8KB 38.9KB +127.0B
esql 9.2KB 8.2KB -1015.0B
esqlDataGrid 9.9KB 9.2KB -697.0B
eventAnnotationListing 11.5KB 11.6KB +141.0B
exploratoryView 41.9KB 40.1KB -1.8KB
expressions 93.4KB 93.1KB -318.0B
fieldsMetadata 5.2KB 4.4KB -874.0B
filesManagement 4.6KB 4.8KB +139.0B
fleet 164.5KB 163.6KB -920.0B
globalSearchBar 22.4KB 20.1KB -2.3KB
graph 8.8KB 8.9KB +141.0B
imageEmbeddable 6.0KB 6.1KB +75.0B
indexManagement 31.6KB 31.7KB +76.0B
infra 49.8KB 50.5KB +761.0B
interactiveSetup 41.9KB 38.6KB -3.4KB
inventory 13.8KB 14.0KB +219.0B
kbnUiSharedDeps-srcJs 3.6MB 3.6MB +7.2KB
kibanaReact 23.6KB 22.2KB -1.5KB
lens 57.8KB 58.3KB +517.0B
links 7.8KB 8.0KB +228.0B
logsDataAccess 6.5KB 6.3KB -190.0B
logsShared 119.7KB 119.7KB +7.0B
maps 40.5KB 40.7KB +220.0B
metricsDataAccess 43.6KB 43.7KB +75.0B
ml 85.4KB 84.4KB -978.0B
mockIdpPlugin 7.5KB 6.7KB -833.0B
monitoring 25.6KB 25.7KB +145.0B
observability 94.3KB 94.4KB +89.0B
observabilityAIAssistant 38.5KB 36.6KB -1.9KB
observabilityAIAssistantApp 15.8KB 15.9KB +79.0B
observabilityAiAssistantManagement 5.7KB 5.8KB +71.0B
observabilityOnboarding 11.2KB 11.5KB +280.0B
observabilityShared 74.0KB 73.2KB -728.0B
osquery 43.3KB 43.4KB +72.0B
presentationPanel 11.0KB 10.0KB -1.0KB
presentationUtil 8.2KB 8.3KB +71.0B
profiling 18.3KB 18.4KB +72.0B
reporting 49.4KB 49.5KB +75.0B
savedObjectsTagging 20.0KB 20.1KB +139.0B
searchAssistant 5.4KB 5.5KB +43.0B
searchIndices 9.1KB 9.1KB +14.0B
searchPlayground 8.1KB 8.2KB +84.0B
security 61.4KB 60.5KB -880.0B
securitySolution 89.8KB 90.5KB +723.0B
serverlessSearch 26.0KB 26.1KB +71.0B
sessionView 43.6KB 43.5KB -100.0B
share 56.1KB 55.9KB -155.0B
slo 31.7KB 32.3KB +572.0B
snapshotRestore 25.3KB 25.3KB -65.0B
spaces 29.1KB 28.2KB -955.0B
stackAlerts 24.6KB 24.7KB +75.0B
streamsApp 9.9KB 10.1KB +288.0B
synthetics 27.1KB 27.5KB +369.0B
transform 19.8KB 20.2KB +376.0B
triggersActionsUi 100.0KB 100.2KB +290.0B
uiActionsEnhanced 17.9KB 17.9KB +76.0B
unifiedDocViewer 12.2KB 12.3KB +147.0B
unifiedHistogram 10.2KB 10.3KB +68.0B
unifiedSearch 22.0KB 22.2KB +144.0B
uptime 42.7KB 42.9KB +222.0B
ux 7.3KB 7.4KB +148.0B
visDefaultEditor 29.4KB 29.5KB +153.0B
visTypeTimeseries 17.6KB 17.6KB +76.0B
visTypeVega 34.7KB 34.7KB +12.0B
visualizations 35.1KB 35.4KB +357.0B
wciIndexSource 21.9KB 21.1KB -806.0B
workchatApp 11.0KB 11.1KB +74.0B
total -3.8KB
Unknown metric groups

API count

id before after diff
@kbn/ui-shared-deps-src 77 79 +2

async chunk count

id before after diff
infra 30 29 -1

History

@dej611 dej611 merged commit ef323da into elastic:main Apr 24, 2025
9 checks passed
@dej611 dej611 self-assigned this Apr 28, 2025
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
)

## Summary

Similar to elastic#217034, elastic#217202 and elastic#217467 this time applied to
`react-use`.

This is a slightly different approach than elastic#217034 as we're caching here
only the most common/frequently used methods from the `react-use`
library and leaving the rest to be loaded within the specific plugin
chunks.

What this PR does it fundamentally:
* adds `7.x kb` to the shared bundle
* overall the startup bundle size shrinks about `3.5 kb`
* the async bundle size shrinks of about `350 kb` (mainly due to 3
imports which were targeting `react-use/lib`).

An alternative approach would be to just fix the async import strings in
there, but I thought to it was worth it to make the long step here.
Feedback appreciated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants