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 5f6330f0e5..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,15 +56,18 @@ class LoadingDiff extends React.Component { error }); }); - } + }; render() { const { diff, loading, error } = this.state; if (error) { return ; - } else if (loading || !diff) { + } else if (loading) { return ; - } else { + } else if(!diff){ + return null; + } + else { return ; } }