-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Summary
Occasional crashes occur during the initial loading phase of Music Blocks due to a missing dependency load order. Specifically, the global translation function _ is being used in activity/logoconstants.js before it is defined by utils/utils.
This results in the following runtime error:
Uncaught ReferenceError: _ is not defined
at logoconstants.js?v=999999_fix7:43:22
ScreenShot:
Steps to Reproduce:1. Open the Music Blocks activity in a browser.
2. On slower networks or certain browser environments, the application fails during startup.
3. Open the browser Developer Console.
Observe the error:
Uncaught ReferenceError: _ is not defined
Actual Behavior
The application crashes during initialization because:
_("Not a valid pitch name")
is executed before the _ translation function has been globally defined.
The function is provided by utils/utils, but activity/logoconstants does not explicitly declare it as a dependency. As a result, in some loading sequences, logoconstants.js executes before utils/utils has finished loading.
Expected Behavior:
- All required dependencies should be loaded in the correct order, ensuring that:
- The _ translation function is globally available
- No startup crashes occur due to undefined references
- The application loads reliably across different network speeds and browser environments
Suggested Fix:
Add a shim configuration for activity/logoconstants in js/loader.js to explicitly load utils/utils first:
// In js/loader.js shim configuration
"activity/logoconstants": {
deps: ["utils/utils"]
},
This ensures that:
- utils/utils is loaded before logoconstants.js
- The _ function is available globally
- Startup behavior becomes deterministic and stable
Why This Fix Is Appropriate
- Minimal and safe change
- Maintains current architecture
- Prevents intermittent crashes
- Improves reliability across different environments
- Does not alter runtime logic
Impact
This fix improves:
- Application stability
- First-load reliability
- Developer debugging experience
- User experience during startup
I would be happy to work on this issue and submit a PR if the maintainers agree with the proposed solution.