Skip to content

Commit

Permalink
[APM] Service map - fixes irrelevant services on data refresh (elasti…
Browse files Browse the repository at this point in the history
…c#62750)

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
2 people authored and dgieselaar committed Apr 7, 2020
1 parent a03b40e commit 67b9393
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ export function Cytoscape({
// Trigger a custom "data" event when data changes
useEffect(() => {
if (cy && elements.length > 0) {
const renderedElements = cy.elements('node,edge');
const latestElementIds = elements.map(el => el.data.id);
const absentElements = renderedElements.filter(
el => !latestElementIds.includes(el.id())
);
cy.remove(absentElements);
cy.add(elements);
cy.trigger('data');
}
Expand Down

0 comments on commit 67b9393

Please sign in to comment.