Skip to content

[Discover] Prevent document-level doc viewer tabs from re-mounting when refreshing#248203

Merged
davismcphee merged 14 commits intoelastic:mainfrom
davismcphee:poc-doc-viewer-render-function
Jan 15, 2026
Merged

[Discover] Prevent document-level doc viewer tabs from re-mounting when refreshing#248203
davismcphee merged 14 commits intoelastic:mainfrom
davismcphee:poc-doc-viewer-render-function

Conversation

@davismcphee
Copy link
Contributor

@davismcphee davismcphee commented Jan 7, 2026

📝 Summary

This PR fixes an issue where document-level doc viewer tabs were unnecessarily re-mounting on every refresh, causing poor performance and degraded user experience.

closes #248047

🔎 Background

The doc viewer registry was using inline components that lacked stable component identities, causing React to treat them as new components on each render cycle. This in turn caused a complete loss of component state (like the AI insights as reported in #248047) in the React hierarchy, which can interrupt the user's workflow.

After this change doc viewer registry to use render functions instead of components. This ensures component identity remains stable across renders, preventing unnecessary re-mounts. This is aligned with the implementation of the Discover chart section extension point from #245035.

🎨 Previews

Before

screen-recording-discover-fly-out-remounting-broken-2026-01-09.mov

After

screen-recording-discover-fly-out-remounting-fixed-2026-01-09.mov

🔧 Detailed Changes

  • Modified doc viewer registry API to accept render functions instead of component props
  • Updated all doc viewer tab implementations to provide render functions

🔢 Testing Hints

  • Open the Discover fly-out for a document matching a specialized data source and document profile such as logs, traces or security events.
  • Modify the fly-out state by expanding an accordion section and starting an AI insight request.
  • Click refresh in the Discover query bar or enable auto-refresh.
  • Verify document viewer tabs no longer flicker and retain their state when the refresh finishes.
  • Verify that the hit index in the fly-out header is updated correctly.
  • Test with multiple data views and document types

Release Notes

Prevent loss of UI state in signal-specific Discover fly-out tabs when refreshing a query

…logs profile to stabilize component identity
@davismcphee davismcphee self-assigned this Jan 7, 2026
@davismcphee davismcphee added the Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// label Jan 7, 2026
@weltenwort weltenwort self-assigned this Jan 8, 2026
@weltenwort weltenwort added the Team:obs-exploration Observability Exploration team label Jan 8, 2026
@weltenwort weltenwort changed the title [PoC] [Discover] Prevent log overview doc viewer tab from remounting when using auto-refresh Jan 9, 2026
@weltenwort weltenwort marked this pull request as ready for review January 9, 2026 18:13
@weltenwort weltenwort requested review from a team as code owners January 9, 2026 18:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@weltenwort weltenwort added bug Fixes for quality problems that affect the customer experience release_note:fix labels Jan 9, 2026
Copy link
Contributor Author

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Thanks for taking this over! The latest changes LGTM, but I can't approve since I originally opened it. @akowalska622 Could we get your review on this one please?

@weltenwort weltenwort added backport:version Backport to applied version labels v9.3.0 v9.2.5 labels Jan 12, 2026
@achyutjhunjhunwala achyutjhunjhunwala self-requested a review January 14, 2026 14:17
indexes: ObservabilityIndexes;
}

const LogOverviewTab = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for cleaning this into a proper component

Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

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

Code review only, the DocViewer change LGTM 👌

@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 14, 2026

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #101 / dashboard app - group 6 dashboard snapshots compare controls snapshot in dark mode
  • [job] [logs] FTR Configs #101 / dashboard app - group 6 dashboard snapshots compare controls snapshot in dark mode

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 1979 1980 +1

Async chunks

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

id before after diff
discover 1.4MB 1.4MB +331.0B
streamsApp 1.5MB 1.5MB +4.0B
unifiedDocViewer 371.5KB 371.4KB -32.0B
total +303.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/unified-doc-viewer 4 3 -1

Page load bundle

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

id before after diff
unifiedDocViewer 13.4KB 13.4KB -41.0B

History

cc @weltenwort @davismcphee

@weltenwort
Copy link
Member

CI failures seem to be unrelated, retrying...

@davismcphee davismcphee merged commit 244764a into elastic:main Jan 15, 2026
13 checks passed
@davismcphee davismcphee deleted the poc-doc-viewer-render-function branch January 15, 2026 17:16
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/21039982568

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
9.2 Backport failed because of merge conflicts
9.3 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 248203

Questions ?

Please refer to the Backport tool documentation

weltenwort pushed a commit to weltenwort/kibana that referenced this pull request Jan 15, 2026
…en refreshing (elastic#248203)

## 📝 Summary

This PR fixes an issue where document-level doc viewer tabs were
unnecessarily re-mounting on every refresh, causing poor performance and
degraded user experience.

closes elastic#248047

## 🔎 Background

The doc viewer registry was using inline components that lacked stable
component identities, causing React to treat them as new components on
each render cycle. This in turn caused a complete loss of component
state (like the AI insights as reported in elastic#248047) in the React
hierarchy, which can interrupt the user's workflow.

After this change doc viewer registry to use render functions instead of
components. This ensures component identity remains stable across
renders, preventing unnecessary re-mounts. This is aligned with the
implementation of the Discover chart section extension point from
elastic#245035.

## 🎨 Previews

**Before**

https://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76

**After**

https://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed

## 🔧 Detailed Changes

- Modified doc viewer registry API to accept `render` functions instead
of `component` props
- Updated all doc viewer tab implementations to provide render functions

## 🔢 Testing Hints

- Open the Discover fly-out for a document matching a specialized data
source and document profile such as logs, traces or security events.
- Modify the fly-out state by expanding an accordion section and
starting an AI insight request.
- Click refresh in the Discover query bar or enable auto-refresh.
- Verify document viewer tabs no longer flicker and retain their state
when the refresh finishes.
- Verify that the hit index in the fly-out header is updated correctly.
- Test with multiple data views and document types

## Release Notes

Prevent loss of UI state in signal-specific Discover fly-out tabs when
refreshing a query

---------

Co-authored-by: Felix Stürmer <felix.stuermer@elastic.co>
Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 244764a)

# Conflicts:
#	src/platform/packages/shared/kbn-unified-doc-viewer/src/components/doc_viewer/doc_viewer.test.tsx
@weltenwort
Copy link
Member

💚 All backports created successfully

Status Branch Result
9.3
9.2

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

weltenwort pushed a commit to weltenwort/kibana that referenced this pull request Jan 16, 2026
…en refreshing (elastic#248203)

## 📝 Summary

This PR fixes an issue where document-level doc viewer tabs were
unnecessarily re-mounting on every refresh, causing poor performance and
degraded user experience.

closes elastic#248047

## 🔎 Background

The doc viewer registry was using inline components that lacked stable
component identities, causing React to treat them as new components on
each render cycle. This in turn caused a complete loss of component
state (like the AI insights as reported in elastic#248047) in the React
hierarchy, which can interrupt the user's workflow.

After this change doc viewer registry to use render functions instead of
components. This ensures component identity remains stable across
renders, preventing unnecessary re-mounts. This is aligned with the
implementation of the Discover chart section extension point from
elastic#245035.

## 🎨 Previews

**Before**

https://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76

**After**

https://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed

## 🔧 Detailed Changes

- Modified doc viewer registry API to accept `render` functions instead
of `component` props
- Updated all doc viewer tab implementations to provide render functions

## 🔢 Testing Hints

- Open the Discover fly-out for a document matching a specialized data
source and document profile such as logs, traces or security events.
- Modify the fly-out state by expanding an accordion section and
starting an AI insight request.
- Click refresh in the Discover query bar or enable auto-refresh.
- Verify document viewer tabs no longer flicker and retain their state
when the refresh finishes.
- Verify that the hit index in the fly-out header is updated correctly.
- Test with multiple data views and document types

## Release Notes

Prevent loss of UI state in signal-specific Discover fly-out tabs when
refreshing a query

---------

Co-authored-by: Felix Stürmer <felix.stuermer@elastic.co>
Co-authored-by: Felix Stürmer <weltenwort@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 244764a)

# Conflicts:
#	src/platform/packages/shared/kbn-discover-utils/src/data_types/metrics/custom_doc_view.tsx
#	src/platform/packages/shared/kbn-unified-doc-viewer/src/components/doc_viewer/doc_viewer.test.tsx
#	src/platform/plugins/shared/discover/public/context_awareness/profile_providers/example/example_data_source_profile/profile.tsx
#	src/platform/plugins/shared/discover/public/context_awareness/profile_providers/observability/log_document_profile/accessors/get_doc_viewer.tsx
weltenwort added a commit that referenced this pull request Jan 16, 2026
…ing when refreshing (#248203) (#249289)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Discover] Prevent document-level doc viewer tabs from re-mounting
when refreshing
(#248203)](#248203)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Davis
McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2026-01-15T17:16:35Z","message":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when refreshing
(#248203)\n\n## 📝 Summary\n\nThis PR fixes an issue where
document-level doc viewer tabs were\nunnecessarily re-mounting on every
refresh, causing poor performance and\ndegraded user
experience.\n\ncloses #248047\n\n## 🔎 Background\n\nThe doc
viewer registry was using inline components that lacked
stable\ncomponent identities, causing React to treat them as new
components on\neach render cycle. This in turn caused a complete loss of
component\nstate (like the AI insights as reported in #248047) in the
React\nhierarchy, which can interrupt the user's workflow.\n\nAfter this
change doc viewer registry to use render functions instead
of\ncomponents. This ensures component identity remains stable
across\nrenders, preventing unnecessary re-mounts. This is aligned with
the\nimplementation of the Discover chart section extension point
from\nhttps://github.com//pull/245035.\n\n## 🎨
Previews\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed\n\n##
🔧 Detailed Changes\n\n- Modified doc viewer registry API to
accept `render` functions instead\nof `component` props\n- Updated all
doc viewer tab implementations to provide render functions\n\n## 🔢
Testing Hints\n\n- Open the Discover fly-out for a document matching a
specialized data\nsource and document profile such as logs, traces or
security events.\n- Modify the fly-out state by expanding an accordion
section and\nstarting an AI insight request.\n- Click refresh in the
Discover query bar or enable auto-refresh.\n- Verify document viewer
tabs no longer flicker and retain their state\nwhen the refresh
finishes.\n- Verify that the hit index in the fly-out header is updated
correctly.\n- Test with multiple data views and document types\n\n##
Release Notes\n\nPrevent loss of UI state in signal-specific Discover
fly-out tabs when\nrefreshing a query\n\n---------\n\nCo-authored-by:
Felix Stürmer <felix.stuermer@elastic.co>\nCo-authored-by: Felix Stürmer
<weltenwort@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"244764a170a2aa1bb53409262f88abdb623546da","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:DataDiscovery","backport:version","v9.3.0","Team:obs-exploration","v9.4.0","v9.2.5"],"title":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when
refreshing","number":248203,"url":"https://github.com/elastic/kibana/pull/248203","mergeCommit":{"message":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when refreshing
(#248203)\n\n## 📝 Summary\n\nThis PR fixes an issue where
document-level doc viewer tabs were\nunnecessarily re-mounting on every
refresh, causing poor performance and\ndegraded user
experience.\n\ncloses #248047\n\n## 🔎 Background\n\nThe doc
viewer registry was using inline components that lacked
stable\ncomponent identities, causing React to treat them as new
components on\neach render cycle. This in turn caused a complete loss of
component\nstate (like the AI insights as reported in #248047) in the
React\nhierarchy, which can interrupt the user's workflow.\n\nAfter this
change doc viewer registry to use render functions instead
of\ncomponents. This ensures component identity remains stable
across\nrenders, preventing unnecessary re-mounts. This is aligned with
the\nimplementation of the Discover chart section extension point
from\nhttps://github.com//pull/245035.\n\n## 🎨
Previews\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed\n\n##
🔧 Detailed Changes\n\n- Modified doc viewer registry API to
accept `render` functions instead\nof `component` props\n- Updated all
doc viewer tab implementations to provide render functions\n\n## 🔢
Testing Hints\n\n- Open the Discover fly-out for a document matching a
specialized data\nsource and document profile such as logs, traces or
security events.\n- Modify the fly-out state by expanding an accordion
section and\nstarting an AI insight request.\n- Click refresh in the
Discover query bar or enable auto-refresh.\n- Verify document viewer
tabs no longer flicker and retain their state\nwhen the refresh
finishes.\n- Verify that the hit index in the fly-out header is updated
correctly.\n- Test with multiple data views and document types\n\n##
Release Notes\n\nPrevent loss of UI state in signal-specific Discover
fly-out tabs when\nrefreshing a query\n\n---------\n\nCo-authored-by:
Felix Stürmer <felix.stuermer@elastic.co>\nCo-authored-by: Felix Stürmer
<weltenwort@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"244764a170a2aa1bb53409262f88abdb623546da"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/248203","number":248203,"mergeCommit":{"message":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when refreshing
(#248203)\n\n## 📝 Summary\n\nThis PR fixes an issue where
document-level doc viewer tabs were\nunnecessarily re-mounting on every
refresh, causing poor performance and\ndegraded user
experience.\n\ncloses #248047\n\n## 🔎 Background\n\nThe doc
viewer registry was using inline components that lacked
stable\ncomponent identities, causing React to treat them as new
components on\neach render cycle. This in turn caused a complete loss of
component\nstate (like the AI insights as reported in #248047) in the
React\nhierarchy, which can interrupt the user's workflow.\n\nAfter this
change doc viewer registry to use render functions instead
of\ncomponents. This ensures component identity remains stable
across\nrenders, preventing unnecessary re-mounts. This is aligned with
the\nimplementation of the Discover chart section extension point
from\nhttps://github.com//pull/245035.\n\n## 🎨
Previews\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed\n\n##
🔧 Detailed Changes\n\n- Modified doc viewer registry API to
accept `render` functions instead\nof `component` props\n- Updated all
doc viewer tab implementations to provide render functions\n\n## 🔢
Testing Hints\n\n- Open the Discover fly-out for a document matching a
specialized data\nsource and document profile such as logs, traces or
security events.\n- Modify the fly-out state by expanding an accordion
section and\nstarting an AI insight request.\n- Click refresh in the
Discover query bar or enable auto-refresh.\n- Verify document viewer
tabs no longer flicker and retain their state\nwhen the refresh
finishes.\n- Verify that the hit index in the fly-out header is updated
correctly.\n- Test with multiple data views and document types\n\n##
Release Notes\n\nPrevent loss of UI state in signal-specific Discover
fly-out tabs when\nrefreshing a query\n\n---------\n\nCo-authored-by:
Felix Stürmer <felix.stuermer@elastic.co>\nCo-authored-by: Felix Stürmer
<weltenwort@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"244764a170a2aa1bb53409262f88abdb623546da"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
weltenwort added a commit that referenced this pull request Jan 16, 2026
…ing when refreshing (#248203) (#249353)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Discover] Prevent document-level doc viewer tabs from re-mounting
when refreshing
(#248203)](#248203)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Davis
McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2026-01-15T17:16:35Z","message":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when refreshing
(#248203)\n\n## 📝 Summary\n\nThis PR fixes an issue where
document-level doc viewer tabs were\nunnecessarily re-mounting on every
refresh, causing poor performance and\ndegraded user
experience.\n\ncloses #248047\n\n## 🔎 Background\n\nThe doc
viewer registry was using inline components that lacked
stable\ncomponent identities, causing React to treat them as new
components on\neach render cycle. This in turn caused a complete loss of
component\nstate (like the AI insights as reported in #248047) in the
React\nhierarchy, which can interrupt the user's workflow.\n\nAfter this
change doc viewer registry to use render functions instead
of\ncomponents. This ensures component identity remains stable
across\nrenders, preventing unnecessary re-mounts. This is aligned with
the\nimplementation of the Discover chart section extension point
from\nhttps://github.com//pull/245035.\n\n## 🎨
Previews\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed\n\n##
🔧 Detailed Changes\n\n- Modified doc viewer registry API to
accept `render` functions instead\nof `component` props\n- Updated all
doc viewer tab implementations to provide render functions\n\n## 🔢
Testing Hints\n\n- Open the Discover fly-out for a document matching a
specialized data\nsource and document profile such as logs, traces or
security events.\n- Modify the fly-out state by expanding an accordion
section and\nstarting an AI insight request.\n- Click refresh in the
Discover query bar or enable auto-refresh.\n- Verify document viewer
tabs no longer flicker and retain their state\nwhen the refresh
finishes.\n- Verify that the hit index in the fly-out header is updated
correctly.\n- Test with multiple data views and document types\n\n##
Release Notes\n\nPrevent loss of UI state in signal-specific Discover
fly-out tabs when\nrefreshing a query\n\n---------\n\nCo-authored-by:
Felix Stürmer <felix.stuermer@elastic.co>\nCo-authored-by: Felix Stürmer
<weltenwort@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"244764a170a2aa1bb53409262f88abdb623546da","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:DataDiscovery","backport:version","v9.3.0","Team:obs-exploration","v9.4.0","v9.2.5"],"title":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when
refreshing","number":248203,"url":"https://github.com/elastic/kibana/pull/248203","mergeCommit":{"message":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when refreshing
(#248203)\n\n## 📝 Summary\n\nThis PR fixes an issue where
document-level doc viewer tabs were\nunnecessarily re-mounting on every
refresh, causing poor performance and\ndegraded user
experience.\n\ncloses #248047\n\n## 🔎 Background\n\nThe doc
viewer registry was using inline components that lacked
stable\ncomponent identities, causing React to treat them as new
components on\neach render cycle. This in turn caused a complete loss of
component\nstate (like the AI insights as reported in #248047) in the
React\nhierarchy, which can interrupt the user's workflow.\n\nAfter this
change doc viewer registry to use render functions instead
of\ncomponents. This ensures component identity remains stable
across\nrenders, preventing unnecessary re-mounts. This is aligned with
the\nimplementation of the Discover chart section extension point
from\nhttps://github.com//pull/245035.\n\n## 🎨
Previews\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed\n\n##
🔧 Detailed Changes\n\n- Modified doc viewer registry API to
accept `render` functions instead\nof `component` props\n- Updated all
doc viewer tab implementations to provide render functions\n\n## 🔢
Testing Hints\n\n- Open the Discover fly-out for a document matching a
specialized data\nsource and document profile such as logs, traces or
security events.\n- Modify the fly-out state by expanding an accordion
section and\nstarting an AI insight request.\n- Click refresh in the
Discover query bar or enable auto-refresh.\n- Verify document viewer
tabs no longer flicker and retain their state\nwhen the refresh
finishes.\n- Verify that the hit index in the fly-out header is updated
correctly.\n- Test with multiple data views and document types\n\n##
Release Notes\n\nPrevent loss of UI state in signal-specific Discover
fly-out tabs when\nrefreshing a query\n\n---------\n\nCo-authored-by:
Felix Stürmer <felix.stuermer@elastic.co>\nCo-authored-by: Felix Stürmer
<weltenwort@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"244764a170a2aa1bb53409262f88abdb623546da"}},"sourceBranch":"main","suggestedTargetBranches":["9.3","9.2"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/248203","number":248203,"mergeCommit":{"message":"[Discover]
Prevent document-level doc viewer tabs from re-mounting when refreshing
(#248203)\n\n## 📝 Summary\n\nThis PR fixes an issue where
document-level doc viewer tabs were\nunnecessarily re-mounting on every
refresh, causing poor performance and\ndegraded user
experience.\n\ncloses #248047\n\n## 🔎 Background\n\nThe doc
viewer registry was using inline components that lacked
stable\ncomponent identities, causing React to treat them as new
components on\neach render cycle. This in turn caused a complete loss of
component\nstate (like the AI insights as reported in #248047) in the
React\nhierarchy, which can interrupt the user's workflow.\n\nAfter this
change doc viewer registry to use render functions instead
of\ncomponents. This ensures component identity remains stable
across\nrenders, preventing unnecessary re-mounts. This is aligned with
the\nimplementation of the Discover chart section extension point
from\nhttps://github.com//pull/245035.\n\n## 🎨
Previews\n\n**Before**\n\n\nhttps://github.com/user-attachments/assets/27efbc9a-810b-4c26-81ff-7947a92cfb76\n\n**After**\n\n\nhttps://github.com/user-attachments/assets/d0a164c2-7334-4e3b-bf74-003f05c129ed\n\n##
🔧 Detailed Changes\n\n- Modified doc viewer registry API to
accept `render` functions instead\nof `component` props\n- Updated all
doc viewer tab implementations to provide render functions\n\n## 🔢
Testing Hints\n\n- Open the Discover fly-out for a document matching a
specialized data\nsource and document profile such as logs, traces or
security events.\n- Modify the fly-out state by expanding an accordion
section and\nstarting an AI insight request.\n- Click refresh in the
Discover query bar or enable auto-refresh.\n- Verify document viewer
tabs no longer flicker and retain their state\nwhen the refresh
finishes.\n- Verify that the hit index in the fly-out header is updated
correctly.\n- Test with multiple data views and document types\n\n##
Release Notes\n\nPrevent loss of UI state in signal-specific Discover
fly-out tabs when\nrefreshing a query\n\n---------\n\nCo-authored-by:
Felix Stürmer <felix.stuermer@elastic.co>\nCo-authored-by: Felix Stürmer
<weltenwort@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"244764a170a2aa1bb53409262f88abdb623546da"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels bug Fixes for quality problems that affect the customer experience release_note:fix Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Team:obs-exploration Observability Exploration team v9.2.5 v9.3.0 v9.4.0

8 participants