Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiInMemoryTable] Fixed data reset on selection change. #3419

Merged
merged 5 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 9 additions & 4 deletions src/components/basic_table/in_memory_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,14 @@ export class EuiInMemoryTable<T> 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,
Expand All @@ -281,6 +285,7 @@ export class EuiInMemoryTable<T> extends Component<
query: getQueryFromSearch(nextProps.search, false),
};
}

return null;
}

Expand Down