Skip to content

[Discover sessions as Code] Remove internal references array#252786

Merged
lukasolson merged 9 commits intoelastic:mainfrom
lukasolson:discover_sessions_as_code/remove_internal_references
Feb 20, 2026
Merged

[Discover sessions as Code] Remove internal references array#252786
lukasolson merged 9 commits intoelastic:mainfrom
lukasolson:discover_sessions_as_code/remove_internal_references

Conversation

@lukasolson
Copy link
Copy Markdown
Contributor

Summary

Closes #239970.

Stored panel state no longer has attributes.references. Search source refs (data view, filter indices) are in the dashboard’s top-level references and are extracted in transformIn and injected in transformOut using the same logic as in extract_references.ts / inject_references.ts

@lukasolson lukasolson self-assigned this Feb 12, 2026
@lukasolson lukasolson added Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// Project:Dashboards API labels Feb 12, 2026
@lukasolson lukasolson marked this pull request as ready for review February 18, 2026 18:08
@lukasolson lukasolson requested a review from a team as a code owner February 18, 2026 18:08
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@lukasolson lukasolson added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Feb 18, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 2080 2079 -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.6MB 1.6MB +97.0B
savedSearch 7.0KB 6.9KB -82.0B
total +15.0B

History

cc @lukasolson

@lukasolson lukasolson requested a review from nickpeihl February 18, 2026 23:24
Copy link
Copy Markdown
Contributor

@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.

LGTM, thanks!

Tested locally using a dashboard from main as well as a new dashboard, both with a by ref and by val panel. Opened both in dashboard, inspected SO JSON and API shape, resaved, and checked again. All looked good to me 👍

const { state: extractedState, references } = extract({
type: SavedSearchType,
attributes: storedState.attributes,
const tabReferences: SavedObjectReference[] = [];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could it contain duplicates if e.g. multiple tabs reference the same data view? Doesn't seem like an issue for now since we only support one tab for by val, but mentioning since it doesn't seem like refs are namespaced by tab ID or anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, currently we're not adding a prefix for the tab, but we could definitely add this later.

Comment thread src/platform/plugins/shared/saved_search/common/types.ts
@lukasolson lukasolson merged commit 196062c into elastic:main Feb 20, 2026
16 checks passed
lukasolson added a commit that referenced this pull request Mar 11, 2026
…oard save (#256997)

## Summary

Resolves #256943.

Fixes by-value Classic mode Discover Session panels failing to load
after saving and reloading a dashboard (error: `Could not find reference
for kibanaSavedObjectMeta.searchSourceJSON.index`). This was a bug
introduced in #252786.

### How to verify

This problem really only surfaces in the UX after the changes in
#256293.

1. Create a new dashboard → Add panel → Discover Session.
2. Save a default Classic mode session and return to the dashboard.
3. Save the dashboard and reload the page.
4. The Discover session panel should load without the "Could not find
reference" error.

Co-authored-by: Gonçalo Rica Pais da Silva <goncalo.rica@elastic.co>
sorenlouv pushed a commit that referenced this pull request Mar 17, 2026
…oard save (#256997)

## Summary

Resolves #256943.

Fixes by-value Classic mode Discover Session panels failing to load
after saving and reloading a dashboard (error: `Could not find reference
for kibanaSavedObjectMeta.searchSourceJSON.index`). This was a bug
introduced in #252786.

### How to verify

This problem really only surfaces in the UX after the changes in
#256293.

1. Create a new dashboard → Add panel → Discover Session.
2. Save a default Classic mode session and return to the dashboard.
3. Save the dashboard and reload the page.
4. The Discover session panel should load without the "Could not find
reference" error.

Co-authored-by: Gonçalo Rica Pais da Silva <goncalo.rica@elastic.co>
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Mar 26, 2026
…oard save (elastic#256997)

## Summary

Resolves elastic#256943.

Fixes by-value Classic mode Discover Session panels failing to load
after saving and reloading a dashboard (error: `Could not find reference
for kibanaSavedObjectMeta.searchSourceJSON.index`). This was a bug
introduced in elastic#252786.

### How to verify

This problem really only surfaces in the UX after the changes in
elastic#256293.

1. Create a new dashboard → Add panel → Discover Session.
2. Save a default Classic mode session and return to the dashboard.
3. Save the dashboard and reload the page.
4. The Discover session panel should load without the "Could not find
reference" error.

Co-authored-by: Gonçalo Rica Pais da Silva <goncalo.rica@elastic.co>
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 Project:Dashboards API release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover sessions as Code] Remove internal references array

4 participants