kibana/.i18nrc.json
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

167 lines
11 KiB
JSON

{
"paths": {
"advancedSettings": "src/platform/plugins/private/advanced_settings",
"aiAssistantManagementSelection": "src/platform/plugins/shared/ai_assistant_management/selection",
"alerts": "packages/kbn-alerts/src",
"alertsUIShared": "src/platform/packages/shared/kbn-alerts-ui-shared/src",
"alertingTypes": "src/platform/packages/shared/kbn-alerting-types",
"apmOss": "src/plugins/apm_oss",
"autocomplete": "x-pack/solutions/security/packages/kbn-securitysolution-autocomplete/src",
"avcBanner": "src/platform/packages/shared/kbn-avc-banner/src",
"cases": ["src/platform/packages/shared/kbn-cases-components"],
"cellActions": "src/platform/packages/shared/kbn-cell-actions",
"charts": "src/platform/plugins/shared/charts",
"console": "src/platform/plugins/shared/console",
"contentManagement": "src/platform/packages/shared/content-management",
"core": ["src/core"],
"customIntegrations": "src/platform/plugins/shared/custom_integrations",
"customIntegrationsPackage": "x-pack/solutions/observability/packages/kbn-custom-integrations",
"dashboard": "src/platform/plugins/shared/dashboard",
"cloud": "src/platform/packages/shared/cloud",
"domDragDrop": "src/platform/packages/shared/kbn-dom-drag-drop",
"controls": "src/platform/plugins/shared/controls",
"data": "src/platform/plugins/shared/data",
"observabilityAlertDetails": "x-pack/solutions/observability/packages/alert-details",
"dataViews": "src/platform/plugins/shared/data_views",
"defaultNavigation": ["packages/default-nav", "src/platform/packages/private/default-nav"],
"devTools": "src/platform/plugins/shared/dev_tools",
"discover": [
"src/platform/plugins/shared/discover",
"src/platform/packages/shared/kbn-discover-utils",
"src/platform/packages/shared/kbn-discover-contextual-components"
],
"savedSearch": "src/platform/plugins/shared/saved_search",
"embeddableApi": "src/platform/plugins/shared/embeddable",
"presentationPanel": "src/platform/plugins/private/presentation_panel",
"embeddableExamples": "examples/embeddable_examples",
"esQuery": "src/platform/packages/shared/kbn-es-query/src",
"kbnGridLayout": "src/platform/packages/private/kbn-grid-layout",
"esUi": "src/platform/plugins/shared/es_ui_shared",
"expandableFlyout": "packages/kbn-expandable-flyout",
"expressionGauge": "src/platform/plugins/shared/chart_expressions/expression_gauge",
"expressionHeatmap": "src/platform/plugins/shared/chart_expressions/expression_heatmap",
"expressionMetricVis": "src/platform/plugins/shared/chart_expressions/expression_metric",
"expressionLegacyMetricVis": "src/platform/plugins/shared/chart_expressions/expression_legacy_metric",
"expressionPartitionVis": "src/platform/plugins/shared/chart_expressions/expression_partition_vis",
"expressionXY": "src/platform/plugins/shared/chart_expressions/expression_xy",
"expressions": "src/platform/plugins/shared/expressions",
"expressionTagcloud": "src/platform/plugins/shared/chart_expressions/expression_tagcloud",
"eventAnnotation": "src/platform/plugins/private/event_annotation",
"eventAnnotationListing": "src/platform/plugins/private/event_annotation_listing",
"eventAnnotationCommon": "src/platform/packages/shared/kbn-event-annotation-common",
"eventAnnotationComponents": "src/platform/packages/shared/kbn-event-annotation-components",
"fieldUtils": "src/platform/packages/shared/kbn-field-utils",
"fieldFormats": "src/platform/plugins/shared/field_formats",
"files": "src/platform/plugins/shared/files",
"filesManagement": "src/platform/plugins/private/files_management",
"flot": "src/platform/packages/shared/kbn-flot-charts/lib",
"generateCsv": "src/platform/packages/private/kbn-generate-csv",
"grouping": "src/platform/packages/shared/kbn-grouping/src",
"alertsGrouping": "x-pack/solutions/observability/packages/kbn-alerts-grouping",
"guidedOnboarding": "src/platform/plugins/shared/guided_onboarding",
"guidedOnboardingPackage": "src/platform/packages/shared/kbn-guided-onboarding",
"home": "src/platform/plugins/shared/home",
"homePackages": "src/platform/packages/shared/home",
"indexPatternEditor": "src/platform/plugins/shared/data_view_editor",
"indexPatternFieldEditor": "src/platform/plugins/shared/data_view_field_editor",
"indexPatternManagement": "src/platform/plugins/shared/data_view_management",
"inputControl": "src/platform/plugins/private/input_control_vis",
"inspector": "src/platform/plugins/shared/inspector",
"inspectorViews": "src/legacy/core_plugins/inspector_views",
"interactiveSetup": "src/platform/plugins/private/interactive_setup",
"interpreter": "src/legacy/core_plugins/interpreter",
"imageEmbeddable": "src/platform/plugins/private/image_embeddable",
"kbn": "src/legacy/core_plugins/kibana",
"kbn-esql-validation-autocomplete": "src/platform/packages/shared/kbn-esql-validation-autocomplete/src",
"kbnConfig": "src/platform/packages/shared/kbn-config/src",
"kbnDocViews": "src/legacy/core_plugins/kbn_doc_views",
"kibana_utils": "src/platform/plugins/shared/kibana_utils",
"kibana-react": "src/platform/plugins/shared/kibana_react",
"kibanaOverview": "src/platform/plugins/private/kibana_overview",
"lensFormulaDocs": "src/platform/packages/private/kbn-lens-formula-docs",
"lists": "x-pack/solutions/security/packages/kbn-securitysolution-list-utils/src",
"exceptionList-components": "x-pack/solutions/security/packages/kbn-securitysolution-exception-list-components/src",
"management": [
"src/platform/plugins/shared/management",
"src/platform/packages/private/kbn-management",
"src/platform/packages/shared/kbn-management",
"packages/kbn-management"
],
"monaco": "src/platform/packages/shared/kbn-monaco/src",
"navigation": ["src/platform/plugins/shared/navigation", "packages/solution-nav"],
"links": "src/platform/plugins/private/links",
"newsfeed": "src/platform/plugins/shared/newsfeed",
"presentationUtil": "src/platform/plugins/shared/presentation_util",
"randomSampling": "x-pack/platform/packages/private/kbn-random-sampling",
"reactPackages": ["src/platform/packages/shared/react", "src/platform/packages/private/react"],
"esqlEditor": "src/platform/packages/private/kbn-esql-editor",
"esqlUtils": "src/platform/packages/shared/kbn-esql-utils",
"reporting": "src/platform/packages/private/kbn-reporting",
"savedObjects": "src/platform/plugins/shared/saved_objects",
"savedObjectsFinder": "src/platform/plugins/shared/saved_objects_finder",
"savedObjectsManagement": "src/platform/plugins/shared/saved_objects_management",
"searchConnectors": "src/platform/packages/shared/kbn-search-connectors",
"server": "src/legacy/server",
"share": ["src/platform/plugins/shared/share", "packages/kbn-reporting-share"],
"sharedUXPackages": ["packages/shared-ux", "src/platform/packages/shared/shared-ux", "src/platform/packages/private/shared-ux/"],
"searchApiKeysComponents": "x-pack/solutions/search/packages/kbn-search-api-keys-components",
"searchApiPanels": "src/platform/packages/shared/kbn-search-api-panels/",
"searchErrors": "src/platform/packages/shared/kbn-search-errors",
"searchIndexDocuments": "x-pack/solutions/search/packages/kbn-search-index-documents",
"searchResponseWarnings": "src/platform/packages/shared/kbn-search-response-warnings",
"searchTypes": "src/platform/packages/shared/kbn-search-types",
"securitySolutionPackages": [
"x-pack/solutions/security/packages/data-table",
"x-pack/solutions/security/packages/ecs-data-quality-dashboard",
"x-pack/solutions/security/packages/features",
"x-pack/solutions/security/packages/kbn-cloud-security-posture",
"x-pack/solutions/security/packages/navigation",
"x-pack/solutions/security/packages/side-nav",
"x-pack/solutions/security/packages/upselling"
],
"sharedPlatformPackages": ["x-pack/platform/packages/shared/kbn-cloud-security-posture"],
"serverlessPackages": "packages/serverless",
"sse": ["src/platform/packages/shared/kbn-sse-utils"],
"coloring": "src/platform/packages/shared/kbn-coloring/src",
"languageDocumentation": "src/platform/packages/private/kbn-language-documentation/src",
"esql": "src/platform/plugins/shared/esql",
"esqlDataGrid": "src/platform/plugins/shared/esql_datagrid",
"statusPage": "src/legacy/core_plugins/status_page",
"telemetry": ["src/platform/plugins/shared/telemetry", "src/platform/plugins/shared/telemetry_management_section"],
"timelion": ["src/platform/plugins/private/vis_types/timelion"],
"tryInConsole": "src/platform/packages/shared/kbn-try-in-console/",
"uiActions": ["src/platform/plugins/shared/ui_actions", "src/platform/packages/shared/kbn-ui-actions-browser"],
"uiActionsEnhanced": "src/platform/plugins/shared/ui_actions_enhanced",
"uiActionsExamples": "examples/ui_action_examples",
"usageCollection": "src/platform/plugins/shared/usage_collection",
"userProfileComponents": "src/platform/packages/shared/kbn-user-profile-components",
"utils": "x-pack/solutions/security/packages/kbn-securitysolution-utils/src",
"visDefaultEditor": "src/platform/plugins/private/vis_default_editor",
"visTypeGauge": "src/platform/plugins/private/vis_types/gauge",
"visTypeHeatmap": "src/platform/plugins/private/vis_types/heatmap",
"visTypeMarkdown": "src/platform/plugins/private/vis_type_markdown",
"visTypeMetric": "src/platform/plugins/private/vis_types/metric",
"visTypePie": "src/platform/plugins/private/vis_types/pie",
"visTypeTable": "src/platform/plugins/private/vis_types/table",
"visTypeTagCloud": "src/platform/plugins/private/vis_types/tagcloud",
"visTypeTimeseries": "src/platform/plugins/shared/vis_types/timeseries",
"visTypeVega": "src/platform/plugins/private/vis_types/vega",
"visTypeVislib": "src/platform/plugins/private/vis_types/vislib",
"visTypeXy": "src/platform/plugins/private/vis_types/xy",
"visualizations": "src/platform/plugins/shared/visualizations",
"visualizationUiComponents": "src/platform/packages/shared/kbn-visualization-ui-components",
"visualizationUtils": "src/platform/packages/shared/kbn-visualization-utils",
"unifiedDocViewer": ["src/platform/plugins/shared/unified_doc_viewer", "src/platform/packages/shared/kbn-unified-doc-viewer"],
"unifiedSearch": "src/platform/plugins/shared/unified_search",
"unifiedFieldList": "src/platform/packages/shared/kbn-unified-field-list",
"unifiedHistogram": "src/platform/packages/shared/kbn-unified-histogram",
"unifiedDataTable": "src/platform/packages/shared/kbn-unified-data-table",
"unifiedTabs": "src/platform/packages/shared/kbn-unified-tabs",
"dataGridInTableSearch": "src/platform/packages/shared/kbn-data-grid-in-table-search",
"unsavedChangesBadge": "src/platform/packages/private/kbn-unsaved-changes-badge",
"unsavedChangesPrompt": "src/platform/packages/shared/kbn-unsaved-changes-prompt",
"managedContentBadge": "src/platform/packages/private/kbn-managed-content-badge",
"responseOpsRuleForm": "src/platform/packages/shared/response-ops/rule_form"
},
"translations": []
}