From cab797fd83244025494ba5dfeab047c95a978297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Wed, 12 Dec 2018 15:40:24 +0100 Subject: [PATCH 1/3] show nothing if no diff is there --- .../packages/ui-components/src/repos/LoadingDiff.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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..3abf971168 100644 --- a/scm-ui-components/packages/ui-components/src/repos/LoadingDiff.js +++ b/scm-ui-components/packages/ui-components/src/repos/LoadingDiff.js @@ -52,9 +52,12 @@ class LoadingDiff extends React.Component { 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 ; } } From 3681936e5ced6aa3f4a88d0112deb24b0c2ea7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Wed, 19 Dec 2018 11:30:05 +0100 Subject: [PATCH 2/3] reload diff component if url changes --- .../packages/ui-components/src/repos/LoadingDiff.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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; From ca54b31c9da01c93a67800505d121e9b94f9ac61 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Thu, 20 Dec 2018 09:29:36 +0000 Subject: [PATCH 3/3] Close branch feature/diff_always_loading_when_no_diff