mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-03 20:15:52 +01:00
reload diff component if url changes
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,7 +56,7 @@ class LoadingDiff extends React.Component<Props, State> {
|
||||
error
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { diff, loading, error } = this.state;
|
||||
|
||||
Reference in New Issue
Block a user