Problem/Motivation

With Drupal 10.2.2 (and possibly previous versions), the error $(...).once is not a function is thrown on pages containing a select_or_other widget

Proposed resolution

Replace jQuery.once with drupal/once in MultipleSelectStatesHack.js
@see https://www.drupal.org/node/3158256

Remaining tasks

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

jofitz created an issue. See original summary.

jofitz’s picture

Version: 4.1.0 » 4.x-dev
Assigned: jofitz » Unassigned
Issue summary: View changes
Status: Active » Needs review
lazzyvn’s picture

StatusFileSize
new3.61 KB

@jofitz
You didn't fix it well at all. It must be added once to the library. in js it has to import once. and it must use $().each and not once.forEach, because it uses $(this). Remove your merge request and fixed with my patch

baikho’s picture

Couldn't apply patch from #4, so re-adding

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

vensires’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.35 KB

Patch in #5 works great. I'm setting this as RTBC!

Extra things done:
- Updated the MR to match the changes from the patch
- Changed the info.yml file since according to the documentation the core/once is not available before 9.2.0; this means the new version won't support Drupal 8.8.

Also attaching patch from latest MR diff.

ivnish’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll
vensires’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new1.89 KB

Resolved conflict and rerolled.
The conflict was related to the main module not supporting Drupal version 9 anymore. So it should normally be RTBC.

ivnish changed the visibility of the branch 3418627-replace-jquery.once to hidden.

  • ivnish committed c0d5eb86 on 4.x authored by jofitz
    [#3418627] feat: Replace jQuery.once with drupal/once
    
    By: jofitz
    By:...
ivnish’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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