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

Adds safety checks on AlignmentsDisplay properties to avoid undefined rendering #3758

Merged
merged 4 commits into from Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -18,7 +18,10 @@ const useStyles = makeStyles()({
function AlignmentsDisplay({ model }: { model: AlignmentsDisplayModel }) {
const { PileupDisplay, SNPCoverageDisplay } = model
const { classes } = useStyles()
const top = SNPCoverageDisplay.height
if (!SNPCoverageDisplay) {
return null
}
const top = SNPCoverageDisplay.height ?? 100
return (
<div
data-testid={`display-${getConf(model, 'displayId')}`}
Expand Down
Expand Up @@ -361,6 +361,9 @@ function stateModelFactory(
* #method
*/
trackMenuItems(): MenuItem[] {
if (!self.PileupDisplay) {
return []
}
const extra = getLowerPanelDisplays(pluginManager).map(d => ({
type: 'radio',
label: d.displayName,
Expand Down
Expand Up @@ -73,7 +73,7 @@ const TrackLabel = React.forwardRef<HTMLDivElement, Props>(function (
},
...(session.getTrackActionMenuItems?.(trackConf) || []),
...track.trackMenuItems(),
].sort((a, b) => (b.priority || 0) - (a.priority || 0))
].sort((a, b) => (b?.priority || 0) - (a?.priority || 0))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick but is it true that this needs a nullish check?

Copy link
Collaborator

Choose a reason for hiding this comment

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

might be able to remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was failing on that in testing -- again i wasn't able to explain why exactly it was happening (might have something to do w nextjs and alignments) but yeah.


return (
<Paper ref={ref} className={cx(className, classes.root)}>
Expand Down