From 3cc24b1d2a7a0bb6b7278f273592c0ac876f22e4 Mon Sep 17 00:00:00 2001 From: nickago Date: Tue, 18 Aug 2015 13:38:52 -0700 Subject: Clear state info on section change --- web/react/components/user_settings_general.jsx | 2 +- web/react/components/user_settings_notifications.jsx | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'web') diff --git a/web/react/components/user_settings_general.jsx b/web/react/components/user_settings_general.jsx index 10fec2933..5e7bbcb51 100644 --- a/web/react/components/user_settings_general.jsx +++ b/web/react/components/user_settings_general.jsx @@ -163,7 +163,7 @@ module.exports = React.createClass({ } }, updateSection: function(section) { - this.setState({clientError: ''}); + this.setState(assign({}, this.getInitialState(), {clientError: ''})); this.submitActive = false; this.props.updateSection(section); }, diff --git a/web/react/components/user_settings_notifications.jsx b/web/react/components/user_settings_notifications.jsx index 08f6935a1..799e4d65e 100644 --- a/web/react/components/user_settings_notifications.jsx +++ b/web/react/components/user_settings_notifications.jsx @@ -100,6 +100,10 @@ module.exports = React.createClass({ this.props.updateTab('general'); }, + updateSection: function(section) { + this.setState(this.getInitialState()); + this.props.updateSection(section); + }, componentDidMount: function() { UserStore.addChangeListener(this._onChange); $('#user_settings').on('hidden.bs.modal', this.handleClose); @@ -209,7 +213,7 @@ module.exports = React.createClass({ inputs={inputs} submit={this.handleSubmit} server_error={server_error} - updateSection={function(e){self.props.updateSection("");e.preventDefault();}} + updateSection={function(e){self.updateSection("");e.preventDefault();}} /> ); } else { @@ -226,7 +230,7 @@ module.exports = React.createClass({ ); } @@ -257,7 +261,7 @@ module.exports = React.createClass({ inputs={inputs} submit={this.handleSubmit} server_error={server_error} - updateSection={function(e){self.props.updateSection("");e.preventDefault();}} + updateSection={function(e){self.updateSection("");e.preventDefault();}} /> ); } else { @@ -274,7 +278,7 @@ module.exports = React.createClass({ ); @@ -307,7 +311,7 @@ module.exports = React.createClass({ inputs={inputs} submit={this.handleSubmit} server_error={server_error} - updateSection={function(e){self.props.updateSection("");e.preventDefault();}} + updateSection={function(e){self.updateSection("");e.preventDefault();}} /> ); } else { @@ -322,7 +326,7 @@ module.exports = React.createClass({ ); } @@ -400,7 +404,7 @@ module.exports = React.createClass({ inputs={inputs} submit={this.handleSubmit} server_error={server_error} - updateSection={function(e){self.props.updateSection("");e.preventDefault();}} + updateSection={function(e){self.updateSection("");e.preventDefault();}} /> ); } else { @@ -427,7 +431,7 @@ module.exports = React.createClass({ ); } -- cgit v1.2.3-1-g7c22