mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.17] [Dashboard] Fix controls being overwritten on navigation (#217596)
Closes https://github.com/elastic/kibana/issues/208330
## Summary
Consider how we set `restoredRuntimeState` for controls in
`initializeDashboard`:
ce91dea75c/src/plugins/dashboard/public/dashboard_container/embeddable/create/create_dashboard.ts (L439-L445)
Now, consider the following scenario:
1. We have two dashboards - dashboard B has unsaved changes to its
control group, and dashboard A does not
2. We start in dashboard B and, since it has unsaved control changes,
`restoredRuntimeState[PANELS_CONTROL_GROUP_KEY]` (in
`DashboardContainer`) is populated with these changes
3. We navigate to Dashboard A via the `navigateToDashboard` method,
which calls `initializeDashboard`
4. In `initializeDashboard`, `overrideInput` does **not** have control
group state for dashboard A (since it does not have unsaved control
changes) - so, we skip calling `setRuntimeStateForChild` for dashboard A
5. This means that `DashboardContainer` still has
`restoredRuntimeState[PANELS_CONTROL_GROUP_KEY]` equal to the changes
from dashboard B, which results in Dashboard A's control group getting
overwritten with `restoredRuntimeState[PANELS_CONTROL_GROUP_KEY]` 🔥
If we clear `restoredRuntimeState` in `navigateToDashboard`, this is no
longer an issue - we will now start from a blank slate on navigation,
which is the desired behaviour.
**Before**
https://github.com/user-attachments/assets/d04fa41f-2603-4b64-963d-b59c6be6fa14
**After**
https://github.com/user-attachments/assets/ce42c204-4ed0-4c44-8c15-c2f49a60131b
This commit is contained in:
parent
963a242be4
commit
1b0d1f7623
1 changed files with 1 additions and 0 deletions
|
@ -752,6 +752,7 @@ export class DashboardContainer
|
|||
newSavedObjectId?: string,
|
||||
newCreationOptions?: Partial<DashboardCreationOptions>
|
||||
) => {
|
||||
this.restoredRuntimeState = undefined; // restored runtime state will be set in `initializeDashboard`, if necessary
|
||||
this.integrationSubscriptions.unsubscribe();
|
||||
this.integrationSubscriptions = new Subscription();
|
||||
this.stopSyncingWithUnifiedSearch?.();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue