From 7917f15874d808eced80f4f72cd2bb47ad45dd4a Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Sat, 9 Sep 2017 15:56:01 -0400 Subject: [PATCH 1/3] fix parentheses around interval --- src/components/navigation/www/navigation.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/navigation/www/navigation.jsx b/src/components/navigation/www/navigation.jsx index 744dc5e76..fd48307d7 100644 --- a/src/components/navigation/www/navigation.jsx +++ b/src/components/navigation/www/navigation.jsx @@ -44,7 +44,7 @@ var Navigation = React.createClass({ componentDidMount: function () { if (this.props.session.session.user) { var intervalId = setInterval( - this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username), 120000) + this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)), 120000 ); // check for new messages every 2 mins. this.setState({'messageCountIntervalId': intervalId}); } @@ -57,7 +57,7 @@ var Navigation = React.createClass({ }); if (this.props.session.session.user) { var intervalId = setInterval( - this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username), 120000) + this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)), 120000 ); // check for new messages every 2 mins. this.setState({'messageCountIntervalId': intervalId}); } else { From ffa6b7d376f2cf5b24930348dafcc513c5dba747 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Sat, 9 Sep 2017 16:55:43 -0400 Subject: [PATCH 2/3] call as anonymous method --- src/components/navigation/www/navigation.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/navigation/www/navigation.jsx b/src/components/navigation/www/navigation.jsx index fd48307d7..9a2799860 100644 --- a/src/components/navigation/www/navigation.jsx +++ b/src/components/navigation/www/navigation.jsx @@ -43,9 +43,10 @@ var Navigation = React.createClass({ }, componentDidMount: function () { if (this.props.session.session.user) { - var intervalId = setInterval( - this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)), 120000 - ); // check for new messages every 2 mins. + var intervalId = setInterval(function () { + this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)); + console.log('did things'); + }.bind(this), 120000); // check for new messages every 2 mins. this.setState({'messageCountIntervalId': intervalId}); } }, @@ -56,9 +57,10 @@ var Navigation = React.createClass({ 'accountNavOpen': false }); if (this.props.session.session.user) { - var intervalId = setInterval( - this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)), 120000 - ); // check for new messages every 2 mins. + var intervalId = setInterval(function () { + this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)); + console.log('did things'); + }.bind(this), 120000); // check for new messages every 2 mins. this.setState({'messageCountIntervalId': intervalId}); } else { // clear message count check, and set to default id. From a90dd6e296c0a137c361012e762ee0bbca94b72d Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Sat, 9 Sep 2017 16:59:39 -0400 Subject: [PATCH 3/3] remove debug message --- src/components/navigation/www/navigation.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/navigation/www/navigation.jsx b/src/components/navigation/www/navigation.jsx index 9a2799860..4438718c6 100644 --- a/src/components/navigation/www/navigation.jsx +++ b/src/components/navigation/www/navigation.jsx @@ -45,7 +45,6 @@ var Navigation = React.createClass({ if (this.props.session.session.user) { var intervalId = setInterval(function () { this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)); - console.log('did things'); }.bind(this), 120000); // check for new messages every 2 mins. this.setState({'messageCountIntervalId': intervalId}); } @@ -59,7 +58,6 @@ var Navigation = React.createClass({ if (this.props.session.session.user) { var intervalId = setInterval(function () { this.props.dispatch(messageCountActions.getCount(this.props.session.session.user.username)); - console.log('did things'); }.bind(this), 120000); // check for new messages every 2 mins. this.setState({'messageCountIntervalId': intervalId}); } else {