Fix script load order & initialize doSearch after Activity loads#4948
Fix script load order & initialize doSearch after Activity loads#4948SherylMehta1 wants to merge 4 commits intosugarlabs:masterfrom
Conversation
…tivity UI is ready
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Hey, npx prettier --write js/activity.js |
|
✅ All Jest tests passed! This PR is ready to merge. |
|
✅ All Jest tests passed! This PR is ready to merge. |
|
✅ All Jest tests passed! This PR is ready to merge. |
Hey, thanks for the pointer! |


This PR fixes a set of load-order issues causing early-initialization errors in the console:
doSearch is not definedCannot read properties of undefined (reading 'idInput_custom')index.htmlscripts and RequireJS loadingWhat this PR changes
Replaces early
$(document).ready()execution ofdoSearch()with a safe post-initialization event listener.Introduces a custom
"mb-ready"event dispatched fromActivityonce all dependencies and UI elements are available.Moves search initialization to this new lifecycle point:
Why:
Testing:
Next steps: