Skip to content

fix: resolve docById undefined error #4295

Merged
walterbender merged 1 commit intosugarlabs:masterfrom
BeNikk:fix/docbyid-undefined
Jan 19, 2025
Merged

fix: resolve docById undefined error #4295
walterbender merged 1 commit intosugarlabs:masterfrom
BeNikk:fix/docbyid-undefined

Conversation

@BeNikk
Copy link
Contributor

@BeNikk BeNikk commented Jan 19, 2025

Description

fixes #4292

fix: resolve docById undefined error by ensuring utils.js loads before activity.js

The error "ReferenceError: docById is not defined" was occurring in activity.js
because it was trying to use docById before utils.js was fully loaded. Fixed
this race condition by explicitly ordering module dependencies in RequireJS
to ensure utils.js loads before activity.js.

  • Modified loader.js to load utils/utils before activity/activity
  • Maintains existing folder structure and RequireJS paths configuration
  • No changes to function definitions required

@FirePheonix
Copy link
Contributor

yep. this is correct.

@walterbender
Copy link
Member

This does resolve the issue. But note that the onResize method is getting called before the stage is set up, so we probably want to test that this.stage !== undefined. We can do that in a separate PR

@walterbender walterbender merged commit d08f4b9 into sugarlabs:master Jan 19, 2025
4 checks passed
@BeNikk
Copy link
Contributor Author

BeNikk commented Jan 20, 2025

Sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReferenceError: docById is not defined in activity.js during initialization

3 participants