From 22b22fdef4c71d81071b63b6eae0d1854b1a8af5 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 12 Nov 2024 11:19:40 -0700 Subject: [PATCH] [maps] fix Upgraded maps panel displays Cannot create AbstractESSourceDescriptor when indexPatternId is not provided error and no data (#199690) Closes https://github.com/elastic/kibana/issues/191777 In 8.15, map embeddable was migrated from a legacy embeddable to a react embeddable. This changed reference injection. See below for details. TLDR is that legacy embeddables pass all references to the embeddable factory when no references for the panel exist. React embeddables just pass an empty reference list regardless of if panel references exist or not. [Reference injection with legacy embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/common/dashboard_container/persistable_state/dashboard_container_references.ts#L53) ``` workingState.panels[key] = { ...panel }; const filteredReferences = getReferencesForPanelId(key, references); const panelReferences = filteredReferences.length === 0 ? references : filteredReferences; ``` [Reference injection with react embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx#L835) ``` const rawState = this.getInput().panels[childId].explicitInput; const { id, ...serializedState } = rawState; if (!rawState || Object.keys(serializedState).length === 0) return; const references = getReferencesForPanelId(childId, this.savedObjectReferences); return { rawState, references, }; ``` ### Test instructions 1) install dashboard from 7.17 saved objects from issue. 2) Open dashboard. Verify data-view is found. Note, layer will not load since your install has no index 'logstash-*', but reference problem has been fixed Co-authored-by: Elastic Machine (cherry picked from commit 80a9f40e25c1707d5c73c415b53648398febd646) --- .../dashboard_container/embeddable/dashboard_container.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx index 23052bd094e82..a3ce4e9778f3a 100644 --- a/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx +++ b/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx @@ -835,7 +835,9 @@ export class DashboardContainer const references = getReferencesForPanelId(childId, this.savedObjectReferences); return { rawState, - references, + // references from old installations may not be prefixed with panel id + // fall back to passing all references in these cases to preserve backwards compatability + references: references.length > 0 ? references : this.savedObjectReferences, }; };