mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +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() {
|
||||
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} />;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user