[Discover Sessions as Code] Fix false dashboard unsaved changes#261055
[Discover Sessions as Code] Fix false dashboard unsaved changes#261055lukasolson merged 10 commits into
Conversation
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
| | Omit<SearchEmbeddableByReferenceState, keyof SearchEmbeddableBaseState> | ||
| ); | ||
|
|
||
| export function getSearchEmbeddableComparators( |
There was a problem hiding this comment.
q: just by looking at the structure it's pretty clear to me how this is going to be evaluated, but where/when is that evaluation done?
|
i've done some tests and from the dashboards list it looks good, i was getting the "You have unsaved changes" banner, but when opening a dashboard with a discover session i'm still getting the blue dot that marks that there are changes, is it expected? dashboards.mov |
…m:lukasolson/kibana into discover_sessions_as_code/unsaved_changes
davismcphee
left a comment
There was a problem hiding this comment.
Tested the latest changes and it works great, thanks! Confirmed the dashboard I was testing with in #255213 (review) no longer triggers the unsaved changes indicator on load.
| // While the selected tab is missing or inline editing is in progress, | ||
| // skip tab-dependent comparators so unsaved-changes badges don't appear | ||
| // until the user explicitly applies a tab change. | ||
| ...(shouldSkipTabComparators | ||
| ? Object.fromEntries( | ||
| Object.keys(searchEmbeddable.comparators).map((k) => [k, 'skip']) | ||
| ) | ||
| : {}), |
There was a problem hiding this comment.
Do you know if removing this logic has any actual impact?
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
History
cc @lukasolson |
Summary
Closes #260804.
Related to #260945.
Problem
With
discover.embeddableTransformsenabled, opening a dashboard that includes Discover session panels could mark the dashboard as dirty immediately, even though nothing was edited (issue #260804).Solution
defaultStateintoinitializeUnsavedChangesso comparator inputs fall back to the same defaults when a key is absent on last saved or current serialized state:selected_tab_id→ first tab id when present.selectedTabIdplus other embeddable defaults (sort,grid, and values fromgetSearchEmbeddableDefaults(uiSettings)) so omitted persisted fields align with what we serialize at runtime.compareSelectedTabIdhelper;referenceEqualityon the tab id fields is sufficient oncedefaultStatesupplies the default tab id.get_search_embeddable_comparators.ts(getSearchEmbeddableComparators/getDiscoverSessionEmbeddableComparators) and add unit testsHow to verify
discover.embeddableTransforms.