Skip to content

[BUG] ReferenceError: is not defined in logoconstants.js #6019

@Tharunkunamalla

Description

@Tharunkunamalla

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:

Image 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions