Skip to content

Commit 2aef4eb

Browse files
committed
fix #1377
1 parent 380358d commit 2aef4eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-bootstrap-table2/src/contexts/row-expand-context.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ class RowExpandProvider extends React.Component {
2323

2424
UNSAFE_componentWillReceiveProps(nextProps) {
2525
if (nextProps.expandRow) {
26-
const nextExpanded = nextProps.expandRow.expanded || this.state.expanded;
26+
let nextExpanded = [...(nextProps.expandRow.expanded || this.state.expanded)];
27+
const { nonExpandable = [] } = nextProps.expandRow;
28+
nextExpanded = nextExpanded.filter(rowId => !_.contains(nonExpandable, rowId));
2729
const isClosing = this.state.expanded.reduce((acc, cur) => {
2830
if (!_.contains(nextExpanded, cur)) {
2931
acc.push(cur);
3032
}
3133
return acc;
3234
}, []);
35+
3336
this.setState(() => ({
3437
expanded: nextExpanded,
3538
isClosing

0 commit comments

Comments
 (0)