[Embeddables Rebuild] Make Serialize Function Synchronous#203662
[Embeddables Rebuild] Make Serialize Function Synchronous#203662ThomThomson merged 10 commits intoelastic:mainfrom
Conversation
…synchronousSerialize' into embeddableRefactor/synchronousSerialize
|
/ci |
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
| setIsSaving(true); | ||
| const bookSerializedState = await bookApi.serializeState(); | ||
| const bookSerializedState = bookApi.serializeState(); | ||
| if (!isMounted()) { |
There was a problem hiding this comment.
isMounted check can be removed since callback is now sync
There was a problem hiding this comment.
Addressed and some other cleanups in 8b0809c
| forceRefresh: () => void; | ||
| getSettings: () => DashboardStateFromSettingsFlyout; | ||
| getDashboardPanelFromId: (id: string) => Promise<DashboardPanelState>; | ||
| getDashboardPanelFromId: (id: string) => DashboardPanelState; |
There was a problem hiding this comment.
src/plugins/dashboard/public/dashboard_actions/copy_to_dashboard_modal.tsx still awaits getDashboardPanelFromId.
| @@ -419,31 +412,18 @@ export function initializePanelsManager( | |||
| references: Reference[]; | |||
| }> => { | |||
| const references: Reference[] = []; | |||
There was a problem hiding this comment.
you can remove async from getState method
| closeOverlay(overlay); | ||
| }} | ||
| onSubmit={(addToLibrary: boolean) => { | ||
| onSubmit={async (addToLibrary: boolean) => { |
There was a problem hiding this comment.
now that onSubmit is aysnc, SavedBookEditor should show loading state and disable submit button until onSubmit returns to avoid allowing users to click multiple times
|
/ci |
nreese
left a comment
There was a problem hiding this comment.
kibana-presentation changes LGTM
code review only
|
/ci |
|
@elasticmachine merge upstream |
|
/ci |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
|
davismcphee
left a comment
There was a problem hiding this comment.
Data Discovery changes LGTM! Tested the saved search embeddable locally and saving panel state seems to still work as expected 👍
| ...titleComparators, | ||
| ...timeRange.comparators, | ||
| ...searchEmbeddable.comparators, | ||
| rawSavedObjectAttributes: getUnchangingComparator(), |
There was a problem hiding this comment.
Oh we have other unchanging state like nonPersistedDisplayOptions where maybe this is useful too (not for this PR, just thinking in general). Is getUnchangingComparator intended to be the standard way to handle this?
There was a problem hiding this comment.
Yes! This is the intended workaround.
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/12359199165 |
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/12359199142 |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
) (#204470) # Backport This will backport the following commits from `main` to `8.x`: - [[Embeddables Rebuild] Make Serialize Function Synchronous (#203662)](#203662) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Devon Thomson","email":"devon.thomson@elastic.co"},"sourceCommit":{"committedDate":"2024-12-13T02:25:03Z","message":"[Embeddables Rebuild] Make Serialize Function Synchronous (#203662)\n\nchanges the signature of the `serializeState` function so that\r\nit no longer returns MaybePromise","sha":"abfd590d4d6420da63d129757120e08278ac3211","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Embedding","Team:Presentation","loe:medium","release_note:skip","impact:high","v9.0.0","backport:prev-minor","Feature:Embeddables","project:embeddableRebuild"],"title":"[Embeddables Rebuild] Make Serialize Function Synchronous","number":203662,"url":"https://github.com/elastic/kibana/pull/203662","mergeCommit":{"message":"[Embeddables Rebuild] Make Serialize Function Synchronous (#203662)\n\nchanges the signature of the `serializeState` function so that\r\nit no longer returns MaybePromise","sha":"abfd590d4d6420da63d129757120e08278ac3211"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203662","number":203662,"mergeCommit":{"message":"[Embeddables Rebuild] Make Serialize Function Synchronous (#203662)\n\nchanges the signature of the `serializeState` function so that\r\nit no longer returns MaybePromise","sha":"abfd590d4d6420da63d129757120e08278ac3211"}}]}] BACKPORT--> Co-authored-by: Devon Thomson <devon.thomson@elastic.co>
Summary
This PR changes the signature of the
serializeStatefunction so that it no longer returns aMaybePromise. This change is made in preparation for an architectural shift which will align all Dashboard embeddable interactions onserialized staterather thanruntime stateAdditionally, the one example that used the
asyncversion ofserializeStatehas been updated. Previously the book example embeddable would save changes to its reference at Dashboard save time. After this PR, the book example embeddable saves changes to its reference on save in the editor flyout. This matches our pattern for inline editable panels that can be saved by reference which is used in the Links panel.Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.