Merge with 2.0.0-m3

This commit is contained in:
René Pfeuffer
2018-12-20 10:55:40 +01:00
5 changed files with 123 additions and 9 deletions

View File

@@ -30,6 +30,16 @@ class LoadingDiff extends React.Component<Props, State> {
}
componentDidMount() {
this.fetchDiff();
}
componentDidUpdate(prevProps: Props) {
if(prevProps.url !== this.props.url){
this.fetchDiff();
}
}
fetchDiff = () => {
const { url } = this.props;
apiClient
.get(url)
@@ -46,15 +56,18 @@ class LoadingDiff extends React.Component<Props, State> {
error
});
});
}
};
render() {
const { diff, loading, error } = this.state;
if (error) {
return <ErrorNotification error={error} />;
} else if (loading || !diff) {
} else if (loading) {
return <Loading />;
} else {
} else if(!diff){
return null;
}
else {
return <Diff diff={diff} />;
}
}