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

Conversation

carolinebridge
Copy link
Contributor

User experience when opening 2+ AlignmentsTracks one after another using jbrowse-react-linear-genome-view: application would crash on some undefined properties (SNPCoverageDisplay.height, self.PileupDisplay.type, and .priority of menu items)

Might be something weird with next.js rendering / race conditions / not sure what; adding these checks resolves the issue.

Tested on the JBrowse 2 app and everything working the same as before.

@github-actions github-actions bot added the needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) label Jun 14, 2023
@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Merging #3758 (50a5de6) into main (440980f) will increase coverage by 0.01%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main    #3758      +/-   ##
==========================================
+ Coverage   64.10%   64.11%   +0.01%     
==========================================
  Files         987      987              
  Lines       29663    29667       +4     
  Branches     7094     7097       +3     
==========================================
+ Hits        19014    19020       +6     
+ Misses      10485    10483       -2     
  Partials      164      164              
Impacted Files Coverage Δ
...ments/src/LinearAlignmentsDisplay/models/model.tsx 78.22% <50.00%> (-0.47%) ⬇️
...AlignmentsDisplay/components/AlignmentsDisplay.tsx 63.63% <66.66%> (-3.04%) ⬇️
...iew/src/LinearGenomeView/components/TrackLabel.tsx 92.59% <100.00%> (ø)

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@carolinebridge carolinebridge added bug Something isn't working and removed needs label triage Needs a label to show in changelog (breaking, enhancement, bug, documentation, or internal) labels Jun 15, 2023
@@ -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.

@cmdcolin cmdcolin merged commit b19c71d into main Jun 29, 2023
11 checks passed
@cmdcolin cmdcolin deleted the add-safety-checks-on-alignments-display branch June 29, 2023 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants