Move shouldComponentUpdate
This commit is contained in:
parent
82d6805a71
commit
4be444d524
1 changed files with 13 additions and 13 deletions
|
@ -46,6 +46,19 @@ module.exports = React.createClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
shouldComponentUpdate: function(nextProps, nextState) {
|
||||||
|
// Update if
|
||||||
|
// - The number of summarised events has changed
|
||||||
|
// - or if the summary is currently expanded
|
||||||
|
// - or if the summary is about to toggle to become collapsed
|
||||||
|
// - or if there are fewEvents, meaning the child eventTiles are shown as-is
|
||||||
|
return (
|
||||||
|
nextProps.events.length !== this.props.events.length ||
|
||||||
|
this.state.expanded || nextState.expanded ||
|
||||||
|
nextProps.events.length < this.props.threshold
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
_toggleSummary: function() {
|
_toggleSummary: function() {
|
||||||
this.setState({
|
this.setState({
|
||||||
expanded: !this.state.expanded,
|
expanded: !this.state.expanded,
|
||||||
|
@ -214,19 +227,6 @@ module.exports = React.createClass({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldComponentUpdate: function(nextProps, nextState) {
|
|
||||||
// Update if
|
|
||||||
// - The number of summarised events has changed
|
|
||||||
// - or if the summary is currently expanded
|
|
||||||
// - or if the summary is about to toggle to become collapsed
|
|
||||||
// - or if there are fewEvents, meaning the child eventTiles are shown as-is
|
|
||||||
return (
|
|
||||||
nextProps.events.length !== this.props.events.length ||
|
|
||||||
this.state.expanded || nextState.expanded ||
|
|
||||||
nextProps.events.length < this.props.threshold
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
_getTransition: function(e) {
|
_getTransition: function(e) {
|
||||||
switch (e.getContent().membership) {
|
switch (e.getContent().membership) {
|
||||||
case 'invite': return 'invited';
|
case 'invite': return 'invited';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue