Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Embeddable][Dashboard] Use Serialized State Only #205531

Open
1 of 8 tasks
ThomThomson opened this issue Jan 3, 2025 · 1 comment
Open
1 of 8 tasks

[Embeddable][Dashboard] Use Serialized State Only #205531

ThomThomson opened this issue Jan 3, 2025 · 1 comment
Assignees
Labels
Feature:Dashboard Dashboard related features Feature:Embeddables Relating to the Embeddable system project:embeddableRebuild Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas

Comments

@ThomThomson
Copy link
Contributor

ThomThomson commented Jan 3, 2025

Problem

Currently, the new Embeddable framework has two types of state: SerializedState and RuntimeState.

SerializedState is the form of the state when saved into a Dashboard saved object. I.e. the References are extracted, and state saved externally (by reference) is removed. In contrast RuntimeState is an exact snapshot of the state used by the embeddable to render.

There is an asynchronous method for every embeddable type called deserializeState which is responsible for turning a SerializedState object into a RuntimeState object. Theoretically, RuntimeState can be used to restore an embeddable exactly as it appeared without awaiting the deserializeState method, which could potentially skip a saved object load for By Reference panels.

Because of this, during the course of development, more and more Dashboard functionality was ported from using SerializedState to using RuntimeState. This was in an effort to speed up Dashboard loading, and make the backups and state diffing more streamlined. Currently the relationship between Dashboards and the Embeddable system is as follows:

Image

Unfortunately, these changes also tightly coupled Dashboards to the concept of RuntimeState and introduced a few bugs, some instability, and incorrect behaviours into the system. (1, 2, 3). Many of these issues have been fixed temporarily, but the underlying issues still remain.

Solution

The Dashboard should only interact with embeddables via their serializedState. After this issue is closed, the architecture should look like this:

Image

In order to accomplish this, we need to complete a few sub tasks

  • Make the serialize function synchronous. This is needed because the serialize function is used a lot more often to compare everything as serializedState.
  • Remove in place library transforms
  • Make Copy to Dashboard work with SerializedState
  • Make Save and Return work with SerializedState
  • Make Duplicate panel work with SerializedState
  • Add a new temporary SerializedStateOnly flag to the Embeddable registry that changes Dashboard / Embeddable behaviour
  • Move over all Embeddable types to this new state
  • Remove SerializedStateOnly flag.
@ThomThomson ThomThomson added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas Feature:Embeddables Relating to the Embeddable system project:embeddableRebuild labels Jan 3, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Dashboard Dashboard related features Feature:Embeddables Relating to the Embeddable system project:embeddableRebuild Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
Development

No branches or pull requests

2 participants