diff --git a/src/components/DependencyGraph/index.js b/src/components/DependencyGraph/index.js index cf68204b78..ca6e981e78 100644 --- a/src/components/DependencyGraph/index.js +++ b/src/components/DependencyGraph/index.js @@ -53,23 +53,7 @@ export default class DependencyGraphPage extends Component { }; } componentDidMount() { - this.ensureDependenciesFetched(); - } - - componentDidUpdate() { - const { nodes, links } = this.props; - - if (!nodes || !links) { - this.ensureDependenciesFetched(); - } - } - - ensureDependenciesFetched() { - const { fetchDependencies, nodes, links, loading, error } = this.props; - - if (!(nodes && links) && !(loading || error)) { - fetchDependencies(); - } + this.props.fetchDependencies(); } handleGraphTypeChange(graphType) { @@ -77,16 +61,30 @@ export default class DependencyGraphPage extends Component { } render() { - const { nodes, links, error, dependencies } = this.props; + const { nodes, links, error, dependencies, loading } = this.props; const { graphType } = this.state; const serviceCalls = dependencies.toJS(); - + if (loading) { + return ( +
+
+
+ ); + } if (error) { return ; } if (!nodes || !links) { - return
; + return ( +
+
+
+ No service dependencies found. +
+
+
+ ); } const GRAPH_TYPE_OPTIONS = [