mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +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() {
|
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,7 +56,7 @@ class LoadingDiff extends React.Component<Props, State> {
|
|||||||
error
|
error
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { diff, loading, error } = this.state;
|
const { diff, loading, error } = this.state;
|
||||||
|
|||||||
Reference in New Issue
Block a user