#5305 Fix ReferenceError: toTitleCase undefined in planet UI#5305
#5305 Fix ReferenceError: toTitleCase undefined in planet UI#5305walterbender merged 7 commits intosugarlabs:masterfrom
Conversation
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
Hi! |
|
Hey @walterbender @omsuneri ,I have opened a PR ,please check when you get time. |
|
@Mokshii46 please resolve the conflicts !! |
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
@omsuneri Changes done.Please review it again. |
|
Why do we need to define the function twice? Why cannot we use the version in js/utils/utils.js from the planet code? |
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
You are right!! |
Fix: Resolve toTitleCase undefined error in GlobalTag.js
Summary
Fixes
Uncaught ReferenceError: toTitleCase is not definederror that prevented the Planet view from loading properly by ensuringutils.jsis in the correct location and loaded before dependent modules.Problem
The Music Blocks Planet view was failing to load with the following error:
GlobalTag.jscallstoTitleCase()function during tag renderingutils.js(which definestoTitleCase) was not in the correct directorytext/htmlinstead ofapplication/javascript)Solution
Changes Made
utils.jsto the correct directory (js/utils.js) to match the import path inindex.htmlTechnical Details
index.htmlfile expectsutils.jsatjs/utils.jstoTitleCase()function is now globally accessible whenGlobalTag.jsexecutesBefore:

After:
Testing
utils.jsloads successfully in Network tab (returns 200 OK)application/javascripttoTitleCase is not definederrors in consoleRelated Issues
Fixes #5305
Checklist