Fix console error when logging in with non-english language (#4941)

Этот коммит содержится в:
Joram Wilander
2017-01-03 12:38:51 -05:00
коммит произвёл Corey Hulen
родитель 2308499fa4
Коммит fba49d1b80
3 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@@ -190,15 +190,11 @@ export function emitPostFocusEvent(postId, onSuccess) {
} }
export function emitCloseRightHandSide() { export function emitCloseRightHandSide() {
AppDispatcher.handleServerAction({ SearchStore.storeSearchResults(null, false, false);
type: ActionTypes.RECEIVED_SEARCH, SearchStore.emitSearchChange();
results: null
});
AppDispatcher.handleServerAction({ PostStore.storeSelectedPostId(null);
type: ActionTypes.RECEIVED_POST_SELECTED, PostStore.emitSelectedPostChange(false, false);
postId: null
});
} }
export function emitPostFocusRightHandSideFromSearch(post, isMentionSearch) { export function emitPostFocusRightHandSideFromSearch(post, isMentionSearch) {

Просмотреть файл

@@ -162,12 +162,10 @@ export default class Client {
handleResponse(methodName, successCallback, errorCallback, err, res) { handleResponse(methodName, successCallback, errorCallback, err, res) {
if (res && res.header) { if (res && res.header) {
this.serverVersion = res.header[HEADER_X_VERSION_ID];
if (res.header[HEADER_X_VERSION_ID]) { if (res.header[HEADER_X_VERSION_ID]) {
this.serverVersion = 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]) { if (res.header[HEADER_X_CLUSTER_ID]) {
this.clusterId = res.header[HEADER_X_CLUSTER_ID]; this.clusterId = res.header[HEADER_X_CLUSTER_ID];
} }

Просмотреть файл

@@ -38,6 +38,7 @@ export default class Root extends React.Component {
// Fastclick // Fastclick
FastClick.attach(document.body); FastClick.attach(document.body);
} }
localizationChanged() { localizationChanged() {
const locale = LocalizationStore.getLocale(); const locale = LocalizationStore.getLocale();
@@ -56,13 +57,16 @@ export default class Root extends React.Component {
} }
} }
} }
componentWillReceiveProps(newProps) { componentWillReceiveProps(newProps) {
this.redirectIfNecessary(newProps); this.redirectIfNecessary(newProps);
} }
componentWillMount() { componentWillMount() {
// Redirect if Necessary // Redirect if Necessary
this.redirectIfNecessary(this.props); this.redirectIfNecessary(this.props);
} }
componentDidMount() { componentDidMount() {
// Setup localization listener // Setup localization listener
LocalizationStore.addChangeListener(this.localizationChanged); LocalizationStore.addChangeListener(this.localizationChanged);
@@ -70,9 +74,11 @@ export default class Root extends React.Component {
// Get our localizaiton // Get our localizaiton
GlobalActions.loadDefaultLocale(); GlobalActions.loadDefaultLocale();
} }
componentWillUnmount() { componentWillUnmount() {
LocalizationStore.removeChangeListener(this.localizationChanged); LocalizationStore.removeChangeListener(this.localizationChanged);
} }
render() { render() {
if (this.state.translations == null || this.props.children == null) { if (this.state.translations == null || this.props.children == null) {
return <div/>; return <div/>;