diff --git a/scm-ui-components/packages/ui-components/src/repos/LoadingDiff.js b/scm-ui-components/packages/ui-components/src/repos/LoadingDiff.js index 3abf971168..2ebc4a170b 100644 --- a/scm-ui-components/packages/ui-components/src/repos/LoadingDiff.js +++ b/scm-ui-components/packages/ui-components/src/repos/LoadingDiff.js @@ -30,6 +30,16 @@ class LoadingDiff extends React.Component { } 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 { error }); }); - } + }; render() { const { diff, loading, error } = this.state;