Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Data is loaded twice #1048 #1063
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkat committed Jul 28, 2017
1 parent 864e4b0 commit 5694c5a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/components/Translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,20 @@ import {
class Translation extends Component {
constructor(props) {
super(props);

this.state = {
reRender: false
}
}

componentDidMount = () => {
getMessages().then(response => {
counterpart.registerTranslations('lang', response.data);
counterpart.setLocale('lang');
this.setState({reRender:true},
() => this.setState({reRender:false}));
counterpart.setMissingEntryGenerator(function(key) {
console.error('Missing translation: ' + key);
return '';
});
});
}

render = () => !this.state.reRender && this.props.children;
render = () => this.props.children;
}

export default Translation;

0 comments on commit 5694c5a

Please sign in to comment.