Skip to content

Commit

Permalink
DIG-21418 set this.state.expanded to false if no children is passed t…
Browse files Browse the repository at this point in the history
…o TableRowExpandable
  • Loading branch information
trulsbjo committed Mar 6, 2017
1 parent 9426384 commit 2c2990b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v3.0.2

* Fixed: When no children, or a falsy value, is passed as children to `TableRowExpandable` the row will set the expanded value in this.state to false.

## v3.0.1

* Fixed: State change on props update in `SortableTable` will now only trigger if props have actually changed.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffe-tables-react",
"version": "3.0.1",
"version": "3.0.2",
"description": "React implementation of ffe-tables",
"main": "lib/index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/TableRowExpandable/TableRowExpandable.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class TableRowExpandable extends Component {
const { cells, columns, children } = this.props;
const unexpandable = !children;

if (unexpandable && this.state.expanded) {
this.setState({ expanded: false });
}

return (
<tbody>
<TableRow
Expand Down

0 comments on commit 2c2990b

Please sign in to comment.