Repository navigation
[9.0] [dashboard] fix State being dropped when editing visualize embeddables (#216901) - #216926
Merged
Merged
Conversation
elastic#216901) Closes elastic#216886 8.17 and 8.16 resolve in branch specific patch elastic#216910 ### Problem 1) Open previously saved empty dashboard. `panels$.value` is `{}` 2) add new markdown panel. This takes you to visualize editor. On return to dashboard, embeddable state transfer service contains the markdown embeddable runtime state. `panels$.value` is `{ markdownPanelId: { explicitInput: {}}}`. Markdown panel is rendered with empty serializedState and runtimeState from embeddable transfer service. 3) Click save dashboard. This is where the bug lies. `panels$.value` is not updated to `{ markdownPanelId: { explicitInput: { // serializedState }}}` but instead, remains unchanged. 4) Click duplicate panel. New panel is added to `panels$.value`. This triggers unsaved changes to be stored in session storage. Unsaved changes store `panels$.value` so `{ markdownPanelId: { explicitInput: { // empty!!! }}, duplicatedMarkdownPanelId: { explicitInput: { serializedState }}}` is put into session storage 5) Edit duplicated markdown panel. This takes you to visualize editor. On return to dashboard, embeddable state transfer service contains the new markdown embeddable runtime state for the duplicated panel. This is where things start to fall apart. The dashboard state is loaded from saved object state and `panels` contains the serialized state for both `markdownPanelId` and `duplicatedMarkdownPanelId`. Then unsaved changes state is loaded from dashboard session and replaces dashboard saved state. This causes the first markdown panel to render with empty serializedState. ### Solution The problem is resolved by updating `panels$` on save. This causes step 4 to store the current serializedState in unsaved changes. (cherry picked from commit 45b7af2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.0:Questions ?
Please refer to the Backport tool documentation
Questions ?
Please refer to the Backport tool documentation
Questions ?
Please refer to the Backport tool documentation
Questions ?
Please refer to the Backport tool documentation