Skip to content

Commit d7a1c5b

Browse files
committed
Recalculate the state slice when this.props.select changes
1 parent ff56611 commit d7a1c5b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/Connector.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ export default class Connector extends Component {
3939
this.unsubscribe = context.redux.subscribe(this.handleChange);
4040
}
4141

42+
componentWillReceiveProps(nextProps) {
43+
if (nextProps.select !== this.props.select) {
44+
// Force the state slice recalculation
45+
const atom = this.context.redux.getAtom();
46+
this.handleChange(atom);
47+
}
48+
}
49+
4250
componentWillUnmount() {
4351
this.unsubscribe();
4452
}

0 commit comments

Comments
 (0)