Fix: null check in setSmallerLargerStatus to prevent TypeError on wheel scroll#6437
Conversation
|
❌ 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 |
|
This PR has merge conflicts with Please rebase your branch: # Add upstream remote (one-time setup)
git remote add upstream https://github.com/sugarlabs/musicblocks.git
# Fetch latest master and rebase
git fetch upstream
git rebase upstream/master
# Resolve any conflicts, then:
git push --force-with-lease origin YOUR_BRANCH
|
…ire and bare performanceTracker references
… mouse wheel scroll (fixes sugarlabs#6436)
cd83b4c to
6867fee
Compare
|
Merge conflicts resolved. Ready for review. |
|
The Jest failure is in phrasemaker.test.js due to IndexedDB not supported in the Node/Jest environment — this is a pre-existing failure unrelated to this PR. This PR only modifies js/activity.js and js/logo.js. |
|
@kartikktripathi — conflicts are resolved and CI failures are pre-existing. Could you take another look when you get a chance? Happy to record a video of the bug reproduction if that helps. |
|
jest and lighthouse ci faling take a look |
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