summaryrefslogtreecommitdiffstats
path: root/webapp/components/root.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-03 12:38:51 -0500
committerCorey Hulen <corey@hulen.com>2017-01-03 12:38:51 -0500
commitfba49d1b809077bc4b8e4d8b303e38295151758a (patch)
tree1d8e19a690275b4ff880c3ffeda94503a5eb7a4b /webapp/components/root.jsx
parent2308499fa46a31b455663c164e218a5e3bae6042 (diff)
downloadchat-fba49d1b809077bc4b8e4d8b303e38295151758a.tar.gz
chat-fba49d1b809077bc4b8e4d8b303e38295151758a.tar.bz2
chat-fba49d1b809077bc4b8e4d8b303e38295151758a.zip
Fix console error when logging in with non-english language (#4941)
Diffstat (limited to 'webapp/components/root.jsx')
-rw-r--r--webapp/components/root.jsx6
1 files changed, 6 insertions, 0 deletions
diff --git a/webapp/components/root.jsx b/webapp/components/root.jsx
index 2cfd9d303..be50c7d48 100644
--- a/webapp/components/root.jsx
+++ b/webapp/components/root.jsx
@@ -38,6 +38,7 @@ export default class Root extends React.Component {
// Fastclick
FastClick.attach(document.body);
}
+
localizationChanged() {
const locale = LocalizationStore.getLocale();
@@ -56,13 +57,16 @@ export default class Root extends React.Component {
}
}
}
+
componentWillReceiveProps(newProps) {
this.redirectIfNecessary(newProps);
}
+
componentWillMount() {
// Redirect if Necessary
this.redirectIfNecessary(this.props);
}
+
componentDidMount() {
// Setup localization listener
LocalizationStore.addChangeListener(this.localizationChanged);
@@ -70,9 +74,11 @@ export default class Root extends React.Component {
// Get our localizaiton
GlobalActions.loadDefaultLocale();
}
+
componentWillUnmount() {
LocalizationStore.removeChangeListener(this.localizationChanged);
}
+
render() {
if (this.state.translations == null || this.props.children == null) {
return <div/>;