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

Notify parent component when a new item set changes the row selection #1086

Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- `EuiMutationObserver`'s `children` prop is no longer marked as required ([#1076](https://github.com/elastic/eui/pull/1076))
- Fixed large drop shadows so they work on darker backgrounds ([#1079](https://github.com/elastic/eui/pull/1079))
- Added `resize-observer-polyfill` as a dependency (was previously a devDependency) ([#1085](https://github.com/elastic/eui/pull/1085))

- Fixed `EuiBasicTable` to inform its parent about a selection change triggered by a different set of `items` ([#1086](https://github.com/elastic/eui/pull/1086))

## [`3.3.0`](https://github.com/elastic/eui/tree/v3.3.0)

Expand Down
10 changes: 9 additions & 1 deletion src/components/basic_table/basic_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,15 @@ export class EuiBasicTable extends Component {
nextProps.items.findIndex(item => getItemId(item, itemId) === getItemId(selectedItem, itemId)) !== -1
));

return { selection };
if (selection.length !== prevState.selection.length) {
if (nextProps.selection.onSelectionChange) {
nextProps.selection.onSelectionChange(selection);
}

return { selection };
}

return null;
}

constructor(props) {
Expand Down