summaryrefslogtreecommitdiffstats
path: root/webapp/components/user_settings/user_settings_theme.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-03-24 21:45:23 -0700
committerCorey Hulen <corey@hulen.com>2016-03-24 21:45:23 -0700
commitfb9adbfe5bad035895e21c8205fb99194e203075 (patch)
tree0cc021570d083f81a50a0183012ce39d9053abde /webapp/components/user_settings/user_settings_theme.jsx
parent1147c7ff298d3aabee5f422b454dc65ebbcc3751 (diff)
parente02921f344aece80b90d37986f393326e5f7f98a (diff)
downloadchat-fb9adbfe5bad035895e21c8205fb99194e203075.tar.gz
chat-fb9adbfe5bad035895e21c8205fb99194e203075.tar.bz2
chat-fb9adbfe5bad035895e21c8205fb99194e203075.zip
Merge pull request #2534 from hmhealey/plt2184
PLT-2184 Moved theme reset code to componentWillUnmount
Diffstat (limited to 'webapp/components/user_settings/user_settings_theme.jsx')
-rw-r--r--webapp/components/user_settings/user_settings_theme.jsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/webapp/components/user_settings/user_settings_theme.jsx b/webapp/components/user_settings/user_settings_theme.jsx
index 3414fe2e2..14991037d 100644
--- a/webapp/components/user_settings/user_settings_theme.jsx
+++ b/webapp/components/user_settings/user_settings_theme.jsx
@@ -40,7 +40,6 @@ export default class ThemeSetting extends React.Component {
this.onChange = this.onChange.bind(this);
this.submitTheme = this.submitTheme.bind(this);
this.updateTheme = this.updateTheme.bind(this);
- this.deactivate = this.deactivate.bind(this);
this.resetFields = this.resetFields.bind(this);
this.handleImportModal = this.handleImportModal.bind(this);
@@ -62,12 +61,17 @@ export default class ThemeSetting extends React.Component {
}
}
componentWillReceiveProps(nextProps) {
- if (!this.props.selected && nextProps.selected) {
+ if (this.props.selected && !nextProps.selected) {
this.resetFields();
}
}
componentWillUnmount() {
UserStore.removeChangeListener(this.onChange);
+
+ if (this.props.selected) {
+ const state = this.getStateFromStores();
+ Utils.applyTheme(state.theme);
+ }
}
getStateFromStores() {
const user = UserStore.getCurrentUser();
@@ -147,11 +151,6 @@ export default class ThemeSetting extends React.Component {
updateType(type) {
this.setState({type});
}
- deactivate() {
- const state = this.getStateFromStores();
-
- Utils.applyTheme(state.theme);
- }
resetFields() {
const state = this.getStateFromStores();
state.serverError = null;