kibana/packages/kbn-optimizer/limits.yml
Davis McPhee d536f85005
[Discover] Support Lens fetches across tabs (#218506)
## Summary

This PR implements support for Lens chart fetches across Discover tabs,
and restoring chart state when returning to a tab.

The Lens embeddable does not currently support continuing data fetching
after it's been unmounted, or fully support restoring chart state using
previously fetched data. The Vis team is aware of this request, but in
the meantime we're using an alternative approach that keeps Lens charts
rendered in memory for each tab that's been visited at least once. This
allows fetches to run in the background and displays the resulting chart
when switching back to tabs. Doing this involved some refactoring to
both Discover and Unified Histogram:
- Create a `ChartPortalsRenderer` wrapper component in Discover to lift
chart rendering high up in the React tree and render charts into
[reverse portals](https://github.com/httptoolkit/react-reverse-portal),
ensuring charts are not remounted when switching tabs and continue to be
rendered after switching away from a tab.
- Refactor Unified Histogram from a single "container" component into
three pieces: a `UnifiedHistogramLayout` component, a
`UnifiedHistogramChart` component, and a `useUnifiedHistogram` hook to
tie things together. This approach allows us to render the chart and
hook separately (in a reverse portal) from the layout, making it
possible to separate the lifecycle of both components without keeping
the rest of Discover's components in memory after switching tabs.
- **Important note:** This change had the side effect of bloating the
Unified Histogram page load bundle since we're now exporting a static
hook that isn't dynamically imported. We could have worked around this
by getting creative with dynamic imports, but doing that seemed hacky.
Instead I decided now was a good time to split Unified Histogram out
into a package in order to support tree shaking, which also has the
added benefits of one fewer plugins to load on startup, and simplifying
the Discover async bundles.

There is one flaw with this approach: the `useDiscoverHistogram` hook
currently depends on global services for retrieving the current query
and filters (including global filters) through the `useQuerySubscriber`
hook. This means the values can become out of sync in inactive tabs when
the user modifies them in the current tab. In practice this doesn't seem
to have an effect in most cases since we don't trigger new fetches in
inactive tabs, and sync the the current tab values to the global
services when switching back to a tab. However, we should still fix this
for the MVP with an approach that doesn't leak state since the current
approach is brittle. I avoided doing that in this PR since it would
likely cause more conflicts with #217706, and that PR may introduce a
solution to the issue anyway (syncing global state to the redux store,
which we can rely on in the hook instead).

Resolves #216475.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-05-02 13:39:25 -03:00

197 lines
4.5 KiB
YAML

pageLoadAssetSize:
actions: 20000
advancedSettings: 27596
aiAssistantManagementSelection: 19146
aiops: 32733
alerting: 106936
apm: 64385
apmSourcesAccess: 16765
automaticImport: 25433
banners: 17946
canvas: 29355
cases: 180037
charts: 55000
cloud: 21076
cloudDataMigration: 19170
cloudExperiments: 109746
cloudFullStory: 18493
cloudLinks: 55984
cloudSecurityPosture: 34398
console: 61298
contentConnectors: 65000
contentManagement: 16254
controls: 12000
core: 564663
crossClusterReplication: 65408
customIntegrations: 22034
dashboard: 19000
dashboardEnhanced: 65646
data: 454087
dataQuality: 19384
datasetQuality: 55000
dataUsage: 30000
dataViewEditor: 28082
dataViewFieldEditor: 42021
dataViewManagement: 6250
dataViews: 65000
dataVisualizer: 30000
devTools: 38637
discover: 25000
discoverEnhanced: 42730
discoverShared: 17111
embeddable: 24000
embeddableAlertsTable: 19615
embeddableEnhanced: 22107
enterpriseSearch: 66810
entityManager: 17175
entityManagerApp: 20378
esql: 37000
esqlDataGrid: 24582
esUiShared: 326654
eventAnnotation: 30000
eventAnnotationListing: 25841
exploratoryView: 74673
expressionGauge: 25000
expressionHeatmap: 27505
expressionLegacyMetricVis: 23121
expressionMetricVis: 23121
expressionPartitionVis: 44888
expressions: 140958
expressionTagcloud: 27505
expressionXY: 45000
features: 21723
fieldFormats: 80485
fieldsMetadata: 21885
files: 22673
filesManagement: 18683
fileUpload: 25664
fleet: 190461
globalSearch: 29696
globalSearchBar: 50403
globalSearchProviders: 25554
graph: 31504
grokdebugger: 26779
guidedOnboarding: 42965
home: 30182
imageEmbeddable: 12500
indexLifecycleManagement: 107090
indexManagement: 140608
inference: 20403
infra: 184320
ingestPipelines: 58003
inputControlVis: 172675
inspector: 18000
interactiveSetup: 80000
inventory: 27430
kibanaOverview: 56279
kibanaReact: 74422
kibanaUsageCollection: 16463
kibanaUtils: 79713
lens: 76079
licenseManagement: 41817
licensing: 29004
links: 8200
lists: 22900
logsDataAccess: 16759
logsShared: 281060
logstash: 53548
management: 46112
maps: 46000
mapsEms: 26072
metricsDataAccess: 73287
ml: 89000
mockIdpPlugin: 30000
monitoring: 80000
navigation: 37269
newsfeed: 42228
noDataPage: 5000
observability: 118191
observabilityAIAssistant: 58230
observabilityAIAssistantApp: 27680
observabilityAiAssistantManagement: 19279
observabilityLogsExplorer: 46650
observabilityOnboarding: 19573
observabilityShared: 111036
osquery: 107090
painlessLab: 179748
presentationPanel: 11550
presentationUtil: 9000
productDocBase: 22500
profiling: 36694
remoteClusters: 51327
reporting: 58600
rollup: 97204
runtimeFields: 41752
savedObjects: 108518
savedObjectsFinder: 21691
savedObjectsManagement: 101836
savedObjectsTagging: 59482
savedObjectsTaggingOss: 20590
savedSearch: 16225
screenshotMode: 17856
screenshotting: 22870
searchAssistant: 19831
searchHomepage: 19831
searchIndices: 20519
searchInferenceEndpoints: 20470
searchNavigation: 19233
searchNotebooks: 18942
searchPlayground: 19325
searchprofiler: 67080
searchQueryRules: 19708
searchSynonyms: 20262
security: 81771
securitySolution: 98429
securitySolutionEss: 36000
securitySolutionServerless: 62488
serverless: 16573
serverlessChat: 22715
serverlessObservability: 68747
serverlessSearch: 72995
sessionView: 77750
share: 88160
slo: 45000
snapshotRestore: 79032
spaces: 57868
stackAlerts: 58316
stackConnectors: 67227
streams: 16742
streamsApp: 20537
streamsAppWrapper: 20537
synthetics: 55971
telemetry: 51957
telemetryManagementSection: 38586
threatIntelligence: 44299
timelines: 327300
transform: 41007
triggersActionsUi: 135613
uiActions: 35121
uiActionsEnhanced: 38494
unifiedDocViewer: 25099
unifiedSearch: 23000
upgradeAssistant: 81241
uptime: 60000
urlDrilldown: 30063
urlForwarding: 32579
usageCollection: 39762
ux: 20784
visDefaultEditor: 50178
visTypeGauge: 24113
visTypeHeatmap: 25340
visTypeMarkdown: 9000
visTypeMetric: 23332
visTypePie: 35583
visTypeTable: 94934
visTypeTagcloud: 37575
visTypeTimelion: 68883
visTypeTimeseries: 55203
visTypeVega: 153573
visTypeVislib: 242838
visTypeXy: 46868
visualizations: 41000
watcher: 43598
wciExternalServer: 35000
wciIndexSource: 40000
wciSalesforce: 25000
workchatApp: 25000
workchatFramework: 25000