michaelbromley / michaelbromley/angularUtils
Identifier Conflict due to $window.DISQUS never initialized (Lazy Loading Needed)
- Dominant language
- JavaScript
- Stars
- 2k
- Forks
- 842
- PR merge metrics
- No merged PRs in 30d
Description
Followed all your code but still get an identifier conflict (same comments across multiple articles on blog) and get this error in console:
`angular.js:13550TypeError: Cannot read property 'reset' of undefined
`
Traced it to $window.DISQUS.reset()
$window.DISQUS never gets initialized even though I have the script tag created and appended to the document.
Seems like $window.DISQUS is not defined even though it is created and appended to the document.
I tried modulating it more in code and creating the script tag before calling reset function that you define.
I believe an easy fix maybe in lazy loading the script creation within a promise. I am trying it out now, but if someone has had a similar problem or knows my problem please let me know so I am not wasting my time.
I have not included my code because I have greatly changed it from michaelbromley's code to try and find and fix the issue.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the identifier conflict and inspect the code that creates the DISQUS script and calls $window.DISQUS.reset(). Confirm that initialization completes before reset and that comments no longer conflict across articles; the issue provides no file or test to target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angularjs, javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100