Skip to content

[Embeddables][Serialized State Only] Use serialized state in state transfer service#215424

Closed
Heenawter wants to merge 21 commits intoelastic:mainfrom
Heenawter:serialized-embeddable-transfer-service_2025-03-20
Closed

[Embeddables][Serialized State Only] Use serialized state in state transfer service#215424
Heenawter wants to merge 21 commits intoelastic:mainfrom
Heenawter:serialized-embeddable-transfer-service_2025-03-20

Conversation

@Heenawter
Copy link
Contributor

@Heenawter Heenawter commented Mar 20, 2025

Fixes #213153

Summary

This PR ensures that the embeddable state transfer service exclusively uses serialized state. Previously, the transfer service accepted either runtime state or serialized state - but we are in the process of removing the concept of "runtime state" for embeddables (at least as far as the Dashboard is concerned), and this is one step towards that goal.

Note that this PR is built off the subset of "embeddable state transfer service related" changes from #215416 - all I did was clean up these changes, finalized some of the cases that were missed in the original draft, and updated tests as necessary.

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@Heenawter Heenawter added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Feature:Embeddables Relating to the Embeddable system backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Mar 20, 2025
@elasticmachine
Copy link
Contributor

elasticmachine commented Mar 20, 2025

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!

@Heenawter Heenawter force-pushed the serialized-embeddable-transfer-service_2025-03-20 branch from 5c7e63d to 5d208d3 Compare March 20, 2025 22:35
@Heenawter Heenawter force-pushed the serialized-embeddable-transfer-service_2025-03-20 branch from 5d208d3 to 4c7d4fc Compare March 20, 2025 22:35
@Heenawter Heenawter added loe:medium Medium Level of Effort and removed loe:small Small Level of Effort labels Mar 20, 2025
@Heenawter Heenawter changed the title [Embeddables] Use serialized state in state transfer service [Dashboard][Serialized State Only] Use serialized state in state transfer service Mar 21, 2025
@Heenawter Heenawter changed the title [Dashboard][Serialized State Only] Use serialized state in state transfer service [Embeddables][Serialized State Only] Use serialized state in state transfer service Mar 21, 2025
...omit(panelToCopy.explicitInput, 'id'),
serializedState: {
rawState: { ...omit(panelToCopy.explicitInput, 'id') },
references: panelToCopy.references ?? [],
Copy link
Contributor Author

@Heenawter Heenawter Mar 21, 2025

Choose a reason for hiding this comment

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

Note that getDashboardPanelFromId also conditionally calls snapshotRuntimeState and throws a PanelNotFound error if unable to find any state for a given ID (either via the Dashboard panel state or via the child API) - the only difference in logic here would be that the serialized state is now spread on top of the panel state. But I think that's... okay? And probably safer?

@Heenawter Heenawter force-pushed the serialized-embeddable-transfer-service_2025-03-20 branch from 346d95e to 5e017d2 Compare March 21, 2025 20:12
@elasticmachine
Copy link
Contributor

elasticmachine commented Mar 27, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #109 / dashboard app - group 5 dashboard data-shared attributes data-shared-item title can be reset
  • [job] [logs] FTR Configs #109 / dashboard app - group 5 dashboard data-shared attributes data-shared-item title can be reset
  • [job] [logs] FTR Configs #99 / dashboard panel titles by reference resetting title on a by reference panel sets it to the library title
  • [job] [logs] FTR Configs #99 / dashboard panel titles by reference resetting title on a by reference panel sets it to the library title

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 605 606 +1

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
embeddable 131 132 +1

Async chunks

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

id before after diff
aiops 452.1KB 452.7KB +651.0B
canvas 1017.1KB 1017.1KB +28.0B
cases 1.3MB 1.3MB +13.0B
dashboard 542.9KB 542.8KB -79.0B
lens 1.4MB 1.4MB +169.0B
maps 3.0MB 3.0MB +74.0B
ml 5.4MB 5.4MB +105.0B
presentationPanel 37.5KB 37.6KB +63.0B
slo 929.2KB 929.3KB +42.0B
synthetics 986.3KB 986.3KB +21.0B
visualizations 342.4KB 342.6KB +224.0B
total +1.3KB

Page load bundle

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

id before after diff
embeddable 20.6KB 20.6KB +10.0B
Unknown metric groups

References to deprecated APIs

id before after diff
dashboard 9 7 -2

History

cc @Heenawter

@Heenawter
Copy link
Contributor Author

Heenawter commented Mar 27, 2025

Closing this PR in favour of #216232, which is this same work but opened against the "Serialized state only" larger feature branch instead of main.

As a summary of what the problem is - currently, anything passed into the Dashboard via the embeddable transfer service will always be considered the last saved state for that panel. This is fine for creating and passing back new panels, but it causes bad behaviour when editing existing panels:

Screen.Recording.2025-03-27.at.1.53.31.PM.mov

Unfortunately, until we remove runtime state completely and change the way Dashboard handles state, we cannot merge this partial fix into main directly 😭

@Heenawter Heenawter closed this Mar 27, 2025
Heenawter added a commit to Heenawter/kibana that referenced this pull request Mar 27, 2025
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 Feature:Dashboard Dashboard related features Feature:Embeddables Relating to the Embeddable system impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dashboard][Serialized State Only] Panel management functions

4 participants