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

handle no intervals #3477

Merged
merged 1 commit into from
Jul 11, 2023
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
5 changes: 4 additions & 1 deletion ui/shared/components/panel/variants/VariantUtils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ const variantIntervalOverlap = (variant, padding) => (interval) => {
export const getOverlappedIntervals = (variant, intervals, getIntervalGroup, padding = 0) => {
const { familyGuids = [] } = variant
return familyGuids.reduce((acc, fGuid) => (
[...acc, ...(intervals[getIntervalGroup(fGuid)] || []).filter(variantIntervalOverlap(variant, padding))]), [])
intervals ? [
...acc, ...(intervals[getIntervalGroup(fGuid)] || []).filter(variantIntervalOverlap(variant, padding)),
] : []
), [])
Comment on lines 83 to +87
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a statement before the return as the following is neater?

if (!intervals) {
  return []
}

or write in as:

return intervals ? familyGuids.reduce((acc, fGuid) => (
    [...acc, ...(intervals[getIntervalGroup(fGuid)] || []).filter(variantIntervalOverlap(variant, padding))]), [])
 : []

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is fine. In an urgent release situation we do not nitpick style

}

export const getOverlappedSpliceOutliers = (variant, spliceOutliersByFamily) => (
Expand Down