diff --git a/CHANGELOG.md b/CHANGELOG.md index 8644c253ac1..4d8884f8f96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - Fixed `EuiCollapsibleNavGroup` `titleSize` prop type to properly exclude `l` and `m` sizes ([#3365](https://github.com/elastic/eui/pull/3365)) - Fixed `EuiDatePickerRange` start date popover to sit left under the icon ([#3383](https://github.com/elastic/eui/pull/3383)) - Fixed `EuiHeader` `z-index` issues with popovers and added body classes for the presence of `EuiFlyout` and `EuiCollapsibleNav.isOpen` ([#3398](https://github.com/elastic/eui/pull/3398)) +- Fixed `EuiInMemoryTable` data reset when filter is set and item is selected ([#3419](https://github.com/elastic/eui/pull/3419)) ## [`23.1.0`](https://github.com/elastic/eui/tree/v23.1.0) diff --git a/src/components/basic_table/in_memory_table.tsx b/src/components/basic_table/in_memory_table.tsx index 08a9daa8bc2..1547c492fd3 100644 --- a/src/components/basic_table/in_memory_table.tsx +++ b/src/components/basic_table/in_memory_table.tsx @@ -269,10 +269,14 @@ export class EuiInMemoryTable extends Component< }; } - if ( - (nextProps.search as EuiSearchBarProps) !== - (prevState.prevProps.search as EuiSearchBarProps) - ) { + const nextQuery = nextProps.search + ? (nextProps.search as EuiSearchBarProps).query + : ''; + const prevQuery = prevState.prevProps.search + ? (prevState.prevProps.search as EuiSearchBarProps).query + : ''; + + if (nextQuery !== prevQuery) { return { prevProps: { ...prevState.prevProps, @@ -281,6 +285,7 @@ export class EuiInMemoryTable extends Component< query: getQueryFromSearch(nextProps.search, false), }; } + return null; }