Skip to content

Commit

Permalink
forgot to remove event on window resize at unmount for challenge card…
Browse files Browse the repository at this point in the history
… details
  • Loading branch information
Nick Faulkner committed Sep 4, 2015
1 parent 0672bf6 commit af5bc9a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions infl-components/cards/components/card_details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ CardDetails.Headline = React.createClass({
this._ellipsisHeadline();
},

componentWillUnmount: function(){
this._removeWindowResizeEvent();
},

render : function(){
return (
<h4 className="headline" ref="headline" onClick={this.props.onHeadlineClick}>{this.props.headline}</h4>
Expand All @@ -115,7 +119,12 @@ CardDetails.Headline = React.createClass({
_ellipsisHeadline : function(){
var headline = React.findDOMNode(this.refs.headline);
var headlineMaxHeight = parseInt($(headline).css("max-height"));

ellipsisText.run(headline, headlineMaxHeight);
},

_removeWindowResizeEvent: function(){
$(window).off("resize", this._ellipsisHeadline);
}
});

Expand All @@ -139,6 +148,10 @@ CardDetails.Description = React.createClass({
this._adjustDescriptionHeight();
},

componentWillUnmount: function(){
this._removeWindowResizeEvent();
},

render: function(){
return (
<div ref="description" className="description" dangerouslySetInnerHTML={{__html: this.props.description}}></div>
Expand Down Expand Up @@ -170,6 +183,10 @@ CardDetails.Description = React.createClass({
var description = React.findDOMNode(this.refs.description);
var descriptionMaxHeight = parseInt(description.style.height);
ellipsisText.run(description, descriptionMaxHeight);
},

_removeWindowResizeEvent: function(){
$(window).off("resize", this._adjustDescriptionHeight);
}
});

Expand Down

0 comments on commit af5bc9a

Please sign in to comment.