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

[Embeddables Rebuild] Allow Save and Return for React Embeddables #178673

Merged

Conversation

ThomThomson
Copy link
Contributor

Summary

Simple fix for #178554. There is already an add new panel method that takes into account both the new and old embeddable systems, this PR uses it instead of addNewEmbeddable.

@ThomThomson ThomThomson added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:small Small Level of Effort 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 project:embeddableRebuild labels Mar 13, 2024
@ThomThomson
Copy link
Contributor Author

/ci

@ThomThomson ThomThomson linked an issue Mar 13, 2024 that may be closed by this pull request
@ThomThomson ThomThomson marked this pull request as ready for review March 13, 2024 19:38
@ThomThomson ThomThomson requested a review from a team as a code owner March 13, 2024 19:38
@elasticmachine
Copy link
Contributor

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

@ThomThomson ThomThomson added the release_note:skip Skip the PR/issue when compiling release notes label Mar 13, 2024
@nreese nreese self-requested a review March 14, 2024 14:54
@nreese
Copy link
Contributor

nreese commented Mar 14, 2024

I tried running these changes in #178158 and got the error below when adding a map react embeddable. To set the the environment, pull #178158 and copy src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts from this PR

Screenshot 2024-03-14 at 8 56 15 AM

@ThomThomson
Copy link
Contributor Author

Oh dang, that's the error I got, but I assumed it was due to my changes to your maps refactor. Let me take a look.

@ThomThomson
Copy link
Contributor Author

ThomThomson commented Mar 18, 2024

@nreese I looked into the error today. Turns out that it's failing when inject is called as part of the deserializeState method when it is called on the last saved state.

We need to call deserializeState on the last saved state so that they have the same base for state diffing. In this case though, there is no last saved state (the panel is brand new), so deserializeState gets called with the state as undefined. This is to be expected. The deserializeState method must be coded defensively, because rawState is a completely unknown type.

I was able to work around the issue by modifying the inject code to not throw when the given state is undefined, we should discuss this.

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
dashboard 385.6KB 385.5KB -30.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

LGTM
code review and tested in chrome with react_map_embeddable branch

@ThomThomson ThomThomson merged commit 5aaf92f into elastic:main Mar 21, 2024
16 checks passed
@kibanamachine kibanamachine added v8.14.0 backport:skip This commit does not require backporting labels Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting 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:small Small Level of Effort project:embeddableRebuild release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dashboard] allow "save to dashboard" for react emebbables
5 participants