Fix: null check in setSmallerLargerStatus to prevent TypeError on wheel scroll#6437
Conversation
…ire and bare performanceTracker references
… mouse wheel scroll (fixes sugarlabs#6436)
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
kartikktripathi
left a comment
There was a problem hiding this comment.
Initially, the code looks good, but while trying to reproduce the bug, I was not able to. Can you give the exact steps to reproduce or maybe a clip of this error showing up while you test it?
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Hi @kartikktripathi! Thanks for the review. Here are the exact steps to reproduce: Open Music Blocks in browser This happens because smallerContainer and largerContainer are initialized as null in setupDependencies() and only get assigned later in _setupPaletteMenu(). If the wheel event fires in that window, the crash occurs. |
|
Hey, I tried to reproduce it, but I'm still not able to do so on the master branch. Can you record a video of this bug if possible, and attach it here? That'll be helpful. |
|
hy any updates on this |
Fixes #6436
Problem
When scrolling the mouse wheel on the canvas before the UI is
fully initialized,
setSmallerLargerStatuscrashes with:Root Cause
this.smallerContainerandthis.largerContainercan be nullwhen the wheel event fires before containers are initialized.
Fix
Added a single null guard at the top of
setSmallerLargerStatus:Testing
Checklist