From 01453447ba1fa960266fd28ef32c8c444964cbe1 Mon Sep 17 00:00:00 2001 From: Maria Iriarte <106958839+mariairiartef@users.noreply.github.com> Date: Wed, 3 Dec 2025 10:52:19 +0100 Subject: [PATCH] [Lens] Use current references for checking if data source states are the same (#244700) ## Summary Fix https://github.com/elastic/kibana/issues/234360 Uses current references for checking if data source states are the same. The fix: the "Apply and close" button is enabled when the data view is changed in the in-line editor. https://github.com/user-attachments/assets/6d9a100d-1c20-4184-a861-6221a53e12c5 ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. (cherry picked from commit 57a3353538f365f63d743d6e421cc538175cfcb5) --- .../shared/edit_on_the_fly/lens_configuration_flyout.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/platform/plugins/shared/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx b/x-pack/platform/plugins/shared/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx index 96bb5a957fddd..daf8151b9a527 100644 --- a/x-pack/platform/plugins/shared/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx +++ b/x-pack/platform/plugins/shared/lens/public/app_plugin/shared/edit_on_the_fly/lens_configuration_flyout.tsx @@ -92,7 +92,10 @@ export function LensEditConfigurationFlyout({ previousAttrs.state.datasourceStates[datasourceId], previousAttrs.references, datasourceStates[datasourceId].state, - attributes.references + // Extract references from the current state as they contain resolved data view IDs + // We cannot use attributes.references because they may contain stale data view IDs from when the panel was initially loaded + datasourceMap[datasourceId].getPersistableState(datasourceStates[datasourceId].state) + .references ) : false;