Skip to content

Commit

Permalink
Notify parent component when a new item set changes the row selection (
Browse files Browse the repository at this point in the history
…#1086)

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

* changelog
  • Loading branch information
chandlerprall authored Aug 6, 2018
1 parent 4b535c2 commit 30013e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit 30013e9

Please sign in to comment.