Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set new data on elements after fetch. #80430

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ function CytoscapeComponent({
cy.elements().forEach((element) => {
if (!elementIds.includes(element.data('id'))) {
cy.remove(element);
} else {
// Doing an "add" with an element with the same id will keep the original
// element. Set the data with the new element data.
const newElement = elements.find((el) => el.data.id === element.id());
element.data(newElement?.data ?? element.data());
}
});
cy.trigger('custom:data', [fit]);
Expand Down