[React embeddable] Viewing dashboards with unsaved changes can display empty panels for new by-reference embeddable panels #198853
Labels
bug
Fixes for quality problems that affect the customer experience
impact:high
Addressing this issue will have a high level of impact on the quality/strength of our product.
loe:large
Large Level of Effort
project:embeddableRebuild
Team:Presentation
Presentation Team for Dashboard, Input Controls, and Canvas
See #198846 as a live example.
Problem
Below is the logic used to build embeddable runtime state.
Lets compare this logic for 2 cases with a by-reference links embeddable
Case 1 - By-reference links embeddable with no unsaved changes
parentApi.getSerializedStateForChild
returns{ savedObjectId: '1' }
factory.deserializeState
loads links from saved object and returns{ links: [...]}
initialRuntimeState
is{ links: [...]}
Case 2 - Empty dashboard with unsaved changes to by-reference links embeddable
parentApi.getSerializedStateForChild
returnsundefined
because there is no saved state for the panelfactory.deserializeState
is not runparentApi.getRuntimeStateForChild
returns{ savedObjectId: '1' }
initialRuntimeState
is{ savedObjectId: '1' }
savedObjectId
that has not been loaded.Proposed solution #1
Embeddables should store all by-reference library state as unsaved changes.
Case 2 - Empty dashboard with unsaved changes to by-reference links embeddable
parentApi.getSerializedStateForChild
returnsundefined
because there is no saved state for the panelfactory.deserializeState
is not runparentApi.getRuntimeStateForChild
returns{ savedObjectId: '1', links: [...] }
initialRuntimeState
is{ savedObjectId: '1', links: [...] }
The problem with this solution is that you are now storing library state in 2 places
Users could edit the library item and then return to the unsaved dashboard. They would rightfully be confused if the dashboard showed the unsaved changes version of the library state instead of the newly edited library state.
Proposed solution #2
Embeddables should not be expected to include all library state as unsaved changes for by-reference state. Instead, embeddables should be given the opportunity to hydrate unsaved changes state. Below is the logic that calls
hydrateUnsavedChanges
when provided by the factory.Case 1 - By-reference links embeddable with no unsaved changes
No changes
Case 2 - Empty dashboard with unsaved changes to by-reference links embeddable
parentApi.getSerializedStateForChild
returnsundefined
because there is no saved state for the panelfactory.deserializeState
is not runparentApi.getRuntimeStateForChild
returns{ savedObjectId: '1' }
factory.hydrateByReferenceUnsavedChanges
loads links from saved object and returns{ links: [...]}
initialRuntimeState
is{ links: [...]}
Proposed solution #3
Update comparator tuple with a 4 element that specifies
runtimeState
orserializedState
. Then unsaved changes can be return to help build serializedState and runtimeState. Below is an exampleCase 1 - By-reference links embeddable with no unsaved changes
No changes
Case 2 - Empty dashboard with unsaved changes to by-reference links embeddable
parentApi.getSavedSerializedStateForChild
returnsundefined
because there is no saved state for the panelparentApi.getUnsavedSerializedStateForChild
returns{ savedObjectId: '1' }
factory.deserializeState
loads links from saved object and returns{ links: [...]}
parentApi.getUnsavedRuntimeStateForChild
returns{...}
initialRuntimeState
is{ links: [...]}
The text was updated successfully, but these errors were encountered: