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

Fixes COSE TypeError by filtering the edges in the passed-in options #3178

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

chrtannus
Copy link
Member

@chrtannus chrtannus commented Oct 24, 2023

Associated issues: #3170

  • This PR filters the elements passed in the layout options to discard any edge that has a connected node (source or target) that is not in the passed-in node collection.

Checklist

Author:

  • The proper base branch has been selected. New features go on unstable. Bug-fix patches can go on either unstable or master.
  • Automated tests have been included in this pull request, if possible, for the new feature(s) or bug fix. Check this box if tests are not pragmatically possible (e.g. rendering features could include screenshots or videos instead of automated tests).
  • The associated GitHub issues are included (above).
  • Notes have been included (above).

Reviewers:

  • All automated checks are passing (green check next to latest commit).
  • At least one reviewer has signed off on the pull request.
  • For bug fixes: Just after this pull request is merged, it should be applied to both the master branch and the unstable branch. Normally, this just requires cherry-picking the corresponding merge commit from master to unstable -- or vice versa.

…(discards any edge that has a connected node not in the passed-in node collection) -- #3170
const targetId = e.target().data('id');
const hasSource = nodes.some((n) => n.data('id') === sourceId);
const hasTarget = nodes.some((n) => n.data('id') === targetId);
return !hasSource || !hasTarget;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

FYI, you can use eles.has(someEle) so that you don't have to pull out IDs, but this is fine as-is.

@maxkfranz maxkfranz added this to the 3.26.1 milestone Oct 26, 2023
@maxkfranz maxkfranz merged commit edd0810 into unstable Oct 26, 2023
2 checks passed
maxkfranz added a commit that referenced this pull request Oct 26, 2023
Fixes COSE TypeError by filtering the edges in the passed-in options
@maxkfranz
Copy link
Member

Cherry-picked to master

maxkfranz added a commit that referenced this pull request Oct 26, 2023
Fixes COSE TypeError by filtering the edges in the passed-in options

Cherry-pick to 3.25.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants