mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 14:35:45 +01:00
Merged in feature/diff_always_loading_when_no_diff (pull request #137)
Feature/diff always loading when no diff
This commit is contained in:
@@ -30,6 +30,16 @@ class LoadingDiff extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.fetchDiff();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps: Props) {
|
||||||
|
if(prevProps.url !== this.props.url){
|
||||||
|
this.fetchDiff();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchDiff = () => {
|
||||||
const { url } = this.props;
|
const { url } = this.props;
|
||||||
apiClient
|
apiClient
|
||||||
.get(url)
|
.get(url)
|
||||||
@@ -46,15 +56,18 @@ class LoadingDiff extends React.Component<Props, State> {
|
|||||||
error
|
error
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { diff, loading, error } = this.state;
|
const { diff, loading, error } = this.state;
|
||||||
if (error) {
|
if (error) {
|
||||||
return <ErrorNotification error={error} />;
|
return <ErrorNotification error={error} />;
|
||||||
} else if (loading || !diff) {
|
} else if (loading) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
} else {
|
} else if(!diff){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
return <Diff diff={diff} />;
|
return <Diff diff={diff} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user