Skip to content

Fix Activity initialization order to prevent docById ReferenceError#508

Open
the-shreyash wants to merge 1 commit intosugarlabs:masterfrom
the-shreyash:fix/docById-amd-load-order
Open

Fix Activity initialization order to prevent docById ReferenceError#508
the-shreyash wants to merge 1 commit intosugarlabs:masterfrom
the-shreyash:fix/docById-amd-load-order

Conversation

@the-shreyash
Copy link

Fixes ReferenceError: docById is not defined during Activity initialization.

Root Cause

Activity was instantiated before AMD dependencies (including utils/utils, where docById is defined) were fully loaded.

The line:

const activity = new Activity();

was executed outside the define(MYDEFINES, ...) block, causing constructor execution before module initialization completed.

Fix

Moved new Activity() inside the define(MYDEFINES, ...) callback to ensure proper dependency loading before constructor execution.

Result

Eliminates docById ReferenceError

Ensures correct AMD module lifecycle

Prevents early execution during initialization

Closes #507

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 during Activity initialisation

1 participant