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.

Issue fork disqus-3359581

Command icon 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

Michelle-Buckby created an issue. See original summary.

michelle-buckby’s picture

StatusFileSize
new796 bytes
michelle-buckby’s picture

Updated patch with correct issue number.

keshav.k made their first commit to this issue’s fork.

michelle-buckby’s picture

Status: Active » Needs review
keshavv’s picture

Hi @michelle buckby
I have checked you patch, Looks like it will solve the problem.
I have created the MR for easy merge.
Thank you.

Ruslan Piskarov made their first commit to this issue’s fork.

yukare’s picture

For me it do not work without this change on drupal 10,1,1. With this change it works.

ayush.pandey’s picture

StatusFileSize
new1.31 MB
new1.52 MB

On 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

steven jones’s picture

Status: Needs review » Reviewed & tested by the community

Merge Request !8 is working fine for me too, marking as RTBC.

chike’s picture

Patch #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.

chike’s picture

MR !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.

abhinand gokhala k’s picture

Tested. Patch #2 solved the issue.

yurii o.’s picture

StatusFileSize
new1.22 KB

In patch #2 lost to update
$(once('disqusComments', 'body')).each(function () {

ayush.pandey’s picture

steven jones’s picture

This is still ready to go, the changes in the patch in #15 and MR are essentially the same now.

RobLoach made their first commit to this issue’s fork.

  • RobLoach committed 2e22782a on 2.0.x authored by keshavv
    Issue #3359581: Uncaught TypeError: $(...).once is not a function
    
robloach’s picture

Version: 2.0.1-alpha6 » 2.0.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks so much for the fix!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.