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

Commit

Permalink
Merge pull request #1093 from metasfresh/dev-1048
Browse files Browse the repository at this point in the history
Data is loaded twice #1048 #1063
  • Loading branch information
cadavre committed Aug 1, 2017
2 parents b1d03b2 + 5694c5a commit 7e68308
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 7e68308

Please sign in to comment.