mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
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() {
|
||||
this.setState({
|
||||
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) {
|
||||
switch (e.getContent().membership) {
|
||||
case 'invite': return 'invited';
|
||||
|
|
Loading…
Reference in a new issue