diff options
author | nickago <ngonella@calpoly.edu> | 2015-07-23 09:20:37 -0700 |
---|---|---|
committer | nickago <ngonella@calpoly.edu> | 2015-07-23 10:40:29 -0700 |
commit | dbbe40e893419d78e23b0d73c8bd6a30478cde2c (patch) | |
tree | f1bddf3b77789c226da21b73b7d198eed8e0fa05 /web/react/components/rename_team_modal.jsx | |
parent | 0acab11cf46a9e279d16e803ad32b8aa67e20679 (diff) | |
download | chat-dbbe40e893419d78e23b0d73c8bd6a30478cde2c.tar.gz chat-dbbe40e893419d78e23b0d73c8bd6a30478cde2c.tar.bz2 chat-dbbe40e893419d78e23b0d73c8bd6a30478cde2c.zip |
Added a condition to close event listeners on modals when the component
is unmounted, and set all unsaved data to be cleared from user settings
Diffstat (limited to 'web/react/components/rename_team_modal.jsx')
-rw-r--r-- | web/react/components/rename_team_modal.jsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/web/react/components/rename_team_modal.jsx b/web/react/components/rename_team_modal.jsx index 79836e4a8..dfd775a3b 100644 --- a/web/react/components/rename_team_modal.jsx +++ b/web/react/components/rename_team_modal.jsx @@ -44,11 +44,14 @@ module.exports = React.createClass({ onNameChange: function() { this.setState({ name: this.refs.name.getDOMNode().value }) }, + handleClose: function() { + this.setState({ name: this.props.teamDisplayName, name_error: "", server_error: ""}); + }, componentDidMount: function() { - var self = this; - $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function(e) { - self.setState({ name: self.props.teamDisplayName, name_error: "", server_error: ""}); - }); + $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', this.handleClose); + }, + componentWillUnmount: function() { + $(this.refs.modal.getDOMNode()).off('hidden.bs.modal', this.handleClose); }, getInitialState: function() { return { name: this.props.teamDisplayName }; |