Skip to content

Commit

Permalink
Fix console error when logging in with non-english language (mattermo…
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander authored and coreyhulen committed Jan 3, 2017
1 parent 9961d58 commit 350074a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 4 additions & 8 deletions actions/global_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,11 @@ export function emitPostFocusEvent(postId, onSuccess) {
}

export function emitCloseRightHandSide() {
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_SEARCH,
results: null
});
SearchStore.storeSearchResults(null, false, false);
SearchStore.emitSearchChange();

AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_POST_SELECTED,
postId: null
});
PostStore.storeSelectedPostId(null);
PostStore.emitSelectedPostChange(false, false);
}

export function emitPostFocusRightHandSideFromSearch(post, isMentionSearch) {
Expand Down
2 changes: 0 additions & 2 deletions client/client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,10 @@ export default class Client {

handleResponse(methodName, successCallback, errorCallback, err, res) {
if (res && res.header) {
this.serverVersion = res.header[HEADER_X_VERSION_ID];
if (res.header[HEADER_X_VERSION_ID]) {
this.serverVersion = res.header[HEADER_X_VERSION_ID];
}

this.clusterId = res.header[HEADER_X_CLUSTER_ID];
if (res.header[HEADER_X_CLUSTER_ID]) {
this.clusterId = res.header[HEADER_X_CLUSTER_ID];
}
Expand Down
6 changes: 6 additions & 0 deletions components/root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class Root extends React.Component {
// Fastclick
FastClick.attach(document.body);
}

localizationChanged() {
const locale = LocalizationStore.getLocale();

Expand All @@ -56,23 +57,28 @@ 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);

// Get our localizaiton
GlobalActions.loadDefaultLocale();
}

componentWillUnmount() {
LocalizationStore.removeChangeListener(this.localizationChanged);
}

render() {
if (this.state.translations == null || this.props.children == null) {
return <div/>;
Expand Down

0 comments on commit 350074a

Please sign in to comment.