File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,7 @@ class RowItem extends Component {
3333 }
3434
3535 shouldComponentUpdate ( nextProps , nextState ) {
36- if ( this . props . forceUpdate !== nextProps . forceUpdate ) {
37- return true
38- }
36+
3937 if ( nextProps . selectedItems !== this . props . selectedItems ) {
4038 if (
4139 this . props . selectedItems . includes ( this . props . item [ this . props . uniqueKey ] ) &&
@@ -53,6 +51,26 @@ class RowItem extends Component {
5351 if ( this . state . subToggled !== nextState . subToggled ) {
5452 return true
5553 }
54+
55+ // propagate updates to child items
56+ // when adding/removing child items when
57+ // parent isn't selected
58+
59+ if (
60+ this . props . item [ this . props . subKey ] &&
61+ this . props . item [ this . props . subKey ] . findIndex ( el =>
62+ nextProps . selectedItems . includes ( el [ this . props . uniqueKey ] ) ) !== - 1
63+ ) {
64+ return true
65+ }
66+ if (
67+ this . props . item [ this . props . subKey ] &&
68+ this . props . item [ this . props . subKey ] . findIndex ( el =>
69+ this . props . selectedItems . includes ( el [ this . props . uniqueKey ] ) ) !== - 1
70+ ) {
71+ return true
72+ }
73+
5674 }
5775
5876 if ( this . props . searchTerm !== nextProps . searchTerm ) {
You can’t perform that action at this time.
0 commit comments