Problem/Motivation
jquery.once is deprecated
(noticed when working on a D10 project)
Mentioned here https://www.drupal.org/node/3158256
Steps to reproduce
Project is on ^D10
Install and enable Disqus 2.0.1-alpha6
See error in Console on any node where a Disqus comment field is present.
Proposed resolution
Replace core/jquery.once dependency in disqus.libraries.yml with core/once
https://git.drupalcode.org/project/disqus/-/blob/2.0.x/disqus.libraries....
Update JS code and replace $.once() with javascript once()
https://git.drupalcode.org/project/disqus/-/blob/2.0.x/js/disqus.js#L30
Remaining tasks
Provided patch resolves both proposed resolutions.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | uncaught-typeerror-once-is-not-a-function-3359581.patch | 1.22 KB | yurii o. |
Issue fork disqus-3359581
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
michelle-buckby commentedComment #3
michelle-buckby commentedUpdated patch with correct issue number.
Comment #6
michelle-buckby commentedComment #7
keshavv commentedHi @michelle buckby
I have checked you patch, Looks like it will solve the problem.
I have created the MR for easy merge.
Thank you.
Comment #9
yukare commentedFor me it do not work without this change on drupal 10,1,1. With this change it works.
Comment #10
ayush.pandey commentedOn Drupal 10.1.0 with module version
2.0.1-alpha6, the issue is reproducible. The changes in the Merge Request !8 work perfectly and the issue no longer exists after the changes applied.
Before Changes
After changes
Comment #11
steven jones commentedMerge Request !8 is working fine for me too, marking as RTBC.
Comment #12
chikePatch #2 worked for me, MR !8 didn't work. I first added MR !8 and it didn't work so I tried patch #2 and it worked.
Thanks.
Comment #13
chikeMR !8 works.
The issue was I turned off JS Aggregation at the point and I noticed that with JS Aggregation turned off, Disqus is not loaded either with the patch file or with the patch from the merge request.
Incidentally I have to be turning CSS and JS aggregation off and on since with the recent changes in Drupal 10.1 there is still an issue of CSS and JS changes not showing up once aggregation is turned on, and I was making some CSS changes on the site.
Comment #14
abhinand gokhala k commentedTested. Patch #2 solved the issue.
Comment #15
yurii o. commentedIn patch #2 lost to update
$(once('disqusComments', 'body')).each(function () {Comment #16
ayush.pandey commentedComment #17
steven jones commentedThis is still ready to go, the changes in the patch in #15 and MR are essentially the same now.
Comment #20
robloachThanks so much for the fix!