From 628bfeff4a1685292c8f779f14a3fa7c8dfbfd7a Mon Sep 17 00:00:00 2001 From: Davis McPhee Date: Mon, 2 Dec 2024 14:22:53 -0400 Subject: [PATCH] [Unified Data Table] Stop passing data grid density as `key` (#202390) ## Summary When the data grid density setting was added, an issue was found with resetting the density state: https://github.com/elastic/kibana/pull/188495#discussion_r1712510252. It was caused by an EUI bug: https://github.com/elastic/eui/issues/7962. The EUI bug has been fixed and this is no longer an issue, so we can remove the workaround we were using by passing the data grid density in the `key` prop to the data grid to force a re-render. Besides removing a small piece of tech debt, this change improves performance when switching densities, and no longer closes the popover when changing the density (like other settings). ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] 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) (cherry picked from commit 281269f6a050458532b17235df1536984ee0d394) --- .../kbn-unified-data-table/src/components/data_table.tsx | 2 -- .../apps/discover/group2_data_grid3/_data_grid_density.ts | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/kbn-unified-data-table/src/components/data_table.tsx b/packages/kbn-unified-data-table/src/components/data_table.tsx index 7d57188dd1010..7f4297404c4e5 100644 --- a/packages/kbn-unified-data-table/src/components/data_table.tsx +++ b/packages/kbn-unified-data-table/src/components/data_table.tsx @@ -1155,8 +1155,6 @@ export const UnifiedDataTable = ({ /> ) : ( { await dataGrid.clickGridSettings(); await dataGrid.changeDensityValue('Expanded'); - await dataGrid.clickGridSettings(); expect(await dataGrid.getCurrentDensityValue()).to.be('Expanded'); await browser.refresh();