diff --git a/awx/ui/src/screens/TopologyView/MeshGraph.js b/awx/ui/src/screens/TopologyView/MeshGraph.js index 9360580f700b..5b6ca6456249 100644 --- a/awx/ui/src/screens/TopologyView/MeshGraph.js +++ b/awx/ui/src/screens/TopologyView/MeshGraph.js @@ -47,7 +47,7 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) { const [simulationProgress, setSimulationProgress] = useState(null); const history = useHistory(); const { - result: { instance, instanceGroups }, + result: { instance = {}, instanceGroups }, error: fetchError, isLoading, request: fetchDetails, @@ -68,12 +68,13 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) { result: {}, } ); - const { error: fetchInstanceError, dismissError } = useDismissableError(fetchError); useEffect(() => { - fetchDetails(); + if (selectedNode) { + fetchDetails(); + } }, [selectedNode, fetchDetails]); function updateNodeSVG(nodes) { @@ -383,33 +384,31 @@ function MeshGraph({ data, showLegend, zoom, setShowZoomControls }) {
{showLegend && } {instance && ( - <> - {fetchInstanceError && ( - - {t`Failed to update instance.`} - - - )} - - redirectToDetailsPage(selectedNode, history) - } - /> - + + redirectToDetailsPage(selectedNode, history) + } + /> )} + {fetchInstanceError && ( + + {t`Failed to get instance.`} + + + )}
); }