Skip to content

Commit 2ae6a78

Browse files
committed
[APM] Don't trigger map layout if no elements (#66625)
After simplyfying the layout mechanism in #66438, we made it so the `data` event handler would run even if there are no elements. This causes the `layoutstop` handler to run as well, but if we have multiple renders with no elements, multiple `layoutstop` events would by triggered after the elements were loaded, causing the map to jump around, which is especially visible with a single node. Fixes #66528.
1 parent 5f57ad1 commit 2ae6a78

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

x-pack/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export function Cytoscape({
146146
};
147147

148148
const dataHandler: cytoscape.EventHandler = event => {
149-
if (cy) {
149+
if (cy && cy.elements().length > 0) {
150150
if (serviceName) {
151151
resetConnectedEdgeStyle(cy.getElementById(serviceName));
152152
// Add the "primary" class to the node if its id matches the serviceName.

0 commit comments

Comments
 (0)