Skip to content

Fix ReferenceError: docById is not defined in activity.js#4293

Closed
Sarvesh2783 wants to merge 1 commit intosugarlabs:masterfrom
Sarvesh2783:docbyid
Closed

Fix ReferenceError: docById is not defined in activity.js#4293
Sarvesh2783 wants to merge 1 commit intosugarlabs:masterfrom
Sarvesh2783:docbyid

Conversation

@Sarvesh2783
Copy link
Contributor

Fixes #4292 -ReferenceError: docById is not defined in activity.js during initialization

This PR resolves the ReferenceError: docById is not defined in activity.js by replacing the undefined docById function with document.getElementById.

Steps to Reproduce the Error:

  • Clone the repository and set up the project locally.
  • Start a local server (e.g., 127.0.0.1:5500).
  • Open the project in a browser.
  • Observe the console error

musicblocks

Root Cause:

The docById function is not defined in the codebase, leading to this error.

Proposed Solution:

Replaced all occurrences of docById with document.getElementById to ensure proper functionality.

Additional Details

  • This change addresses only the docById error,.
  • The fix has been tested locally to confirm that the error no longer appears in the console.

@walterbender
Copy link
Member

Isn't this defined in utils.js? Why do we need to define it twice?

@FirePheonix
Copy link
Contributor

all we have to do was to comment out the console.log(error) in this one.

@Sarvesh2783
Copy link
Contributor Author

@walterbender Thank you for pointing this out! I missed that the docById function was already defined elsewhere. I'll update the PR to reuse the existing function instead of redefining it.

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