Skip to content

Commit b0e9ec3

Browse files
committed
Set new data on elements after fetch.
When `add`ing an element with an already existing ID, it will use the already existing data instead of setting new data. This made it so when you change the time picker the element health statuses would not update. When we get new elements, replace the existing data for existing elements. Fixes #80335.
1 parent 57413f8 commit b0e9ec3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ function CytoscapeComponent({
8484
cy.elements().forEach((element) => {
8585
if (!elementIds.includes(element.data('id'))) {
8686
cy.remove(element);
87+
} else {
88+
// Doing an "add" with an element with the same id will keep the original
89+
// element. Set the data with the new element data.
90+
const newElement = elements.find((el) => el.data.id === element.id());
91+
element.data(newElement?.data ?? element.data());
8792
}
8893
});
8994
cy.trigger('custom:data', [fit]);

0 commit comments

Comments
 (0)