From 4be444d52482883b4b87d6fc5cac851626b4cb50 Mon Sep 17 00:00:00 2001 From: lukebarnard Date: Mon, 16 Jan 2017 15:12:00 +0100 Subject: [PATCH] Move shouldComponentUpdate --- .../views/elements/MemberEventListSummary.js | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/views/elements/MemberEventListSummary.js b/src/components/views/elements/MemberEventListSummary.js index dc16127017..5474865117 100644 --- a/src/components/views/elements/MemberEventListSummary.js +++ b/src/components/views/elements/MemberEventListSummary.js @@ -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';