Drupal 10 proper once dependency

Created on 13 March 2023, over 1 year ago
Updated 23 January 2024, 10 months ago

Module is not working with Drupal 10 fresh install. I also tested in Simplytest.

Due to CR: https://www.drupal.org/node/3158256 โ†’

We need to use once properly.

๐Ÿ› Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ฟUzbekistan biarr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @biarr
  • ๐Ÿ‡บ๐Ÿ‡ฟUzbekistan biarr
  • ๐Ÿ‡ช๐Ÿ‡ธSpain JoseFran

    I ran into this problem today. With drupal 10.0.4 and Client-side Hierarchical Select v4.0.0

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada WiredEscape

    Also experiencing this problem. No function, no errors displayed.
    Drupal 10.0.4
    PHP 8.1.17
    Client-side Hierarchical Select v4.0.0

  • First commit to issue fork.
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ignaciolflores

    It seems that on the once library has beed updated, the function has changed the signature.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ฟUzbekistan biarr

    Thank you @ignaciolflores
    Code in Merge requests 13 solves the problem.

  • ๐Ÿ‡ณ๐Ÿ‡ฌNigeria chike Nigeria

    Thanks @ignaciolflores

    MR !13 got the module working in Drupal 10.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States tyler-durden

    Any way to get this to a 4.0.1 version? Without this update, this module doesn't actually work in Drupal 10 so I think it's a critical issue.

    Thanks for everyone's work on this module, glad we have this available for d10 as other similar mods don't seem to be moving forward.

  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Ran into this issue myself and the MR solves the problem for me.

    Was affecting a taxonomy field and the menu selection.

    Updating to critical because this module seems to cease to work in D10.

  • ๐Ÿ‡ญ๐Ÿ‡บHungary peter_serfozo

    The most recent patch file generated from the MR if someone needs persistent patch content

  • ๐Ÿ‡ฆ๐Ÿ‡ทArgentina hanoii ๐Ÿ‡ฆ๐Ÿ‡ทUTC-3
  • ๐Ÿ‡ฆ๐Ÿ‡ทArgentina hanoii ๐Ÿ‡ฆ๐Ÿ‡ทUTC-3
  • ๐Ÿ‡จ๐Ÿ‡ทCosta Rica maxmendez

    Tested merge request #13 and works perfectly. Thanks @hanoii for your work!.

  • Thanks for all the effort. Will there also be a new version released?

    I tried to install the patch mentioned in #13, but I'm getting an error that the patch cannot be applied.
    If there's any other way of doing this, I would appreciate it if someone could give some tips.

  • ๐Ÿ‡จ๐Ÿ‡ทCosta Rica maxmendez

    In my case, i'm using "drupal/cshs": "^4.0" an the patch work without problems. Did you use the stable package or dev?

  • same here, also using "drupal/cshs": "^4.0"
    fyi I never used a patch before, so no experience...

    I added this to composer.json:

    "enable-patching": true,
    "patches": {
    "drupal/cshs": {
    "patch mr13": "https://git.drupalcode.org/project/cshs/-/merge_requests/13.patch"
    }
    },

    and I get the error: "Could not apply patch! Skipping. The error was: Cannot apply patch https://git.drupalcode.org/project/cshs/-/merge_requests/13.patch"

    Not sure if this is relevant, but I'm working in a local WAMP environment.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada smulvih2 Canada ๐Ÿ

    #12 worked for me on core 10.0.10 and cshs 4.0.0. +1 RTBC.

    Had to hard refresh page to get working after applying #12.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium tim-diels Belgium ๐Ÿ‡ง๐Ÿ‡ช

    Experienced the same issue. Normal dropdown before patch, hierarchical dropdown after patch from MR13. Good Work.
    +1 RTBC

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia mfuggle

    I have applied the MR13 patch to cshs without success. I am using Drupal 10.1.2 and Php 8.1.18. I have created a content type to test cshs and as soon as I create content using the test I get the errors shown below. Unfortunately I 'configure' things but am not a 'coder' so I am not sure where to start looking for the fix to the issues below:

    drupal.js?v=10.1.2:64 Uncaught TypeError: $(...).once is not a function
        at Object.attach (cshs.ts:14:10)
        at drupal.js?v=10.1.2:166:24
        at Array.forEach (<anonymous>)
        at Drupal.attachBehaviors (drupal.js?v=10.1.2:162:34)
        at big_pipe.js?v=10.1.2:118:10
        at big_pipe.js?v=10.1.2:138:3
    attach @ cshs.ts:14
    (anonymous) @ drupal.js?v=10.1.2:166
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ big_pipe.js?v=10.1.2:118
    (anonymous) @ big_pipe.js?v=10.1.2:138
    setTimeout (async)
    Drupal.throwError @ drupal.js?v=10.1.2:63
    (anonymous) @ drupal.js?v=10.1.2:168
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ big_pipe.js?v=10.1.2:118
    (anonymous) @ big_pipe.js?v=10.1.2:138
    drupal.js?v=10.1.2:64 Uncaught TypeError: $(...).once is not a function
        at Object.attach (cshs.ts:14:10)
        at drupal.js?v=10.1.2:166:24
        at Array.forEach (<anonymous>)
        at Drupal.attachBehaviors (drupal.js?v=10.1.2:162:34)
        at HTMLUListElement.<anonymous> (ajax.js?v=10.1.2:1362:20)
        at Function.each (jquery.min.js?v=3.7.0:2:3129)
        at ce.fn.init.each (jquery.min.js?v=3.7.0:2:1594)
        at Drupal.AjaxCommands.insert (ajax.js?v=10.1.2:1360:21)
        at ajax.js?v=10.1.2:1034:41
    attach @ cshs.ts:14
    (anonymous) @ drupal.js?v=10.1.2:166
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ ajax.js?v=10.1.2:1362
    each @ jquery.min.js?v=3.7.0:2
    each @ jquery.min.js?v=3.7.0:2
    insert @ ajax.js?v=10.1.2:1360
    (anonymous) @ ajax.js?v=10.1.2:1034
    setTimeout (async)
    Drupal.throwError @ drupal.js?v=10.1.2:63
    (anonymous) @ drupal.js?v=10.1.2:168
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ ajax.js?v=10.1.2:1362
    each @ jquery.min.js?v=3.7.0:2
    each @ jquery.min.js?v=3.7.0:2
    insert @ ajax.js?v=10.1.2:1360
    (anonymous) @ ajax.js?v=10.1.2:1034
    Promise.then (async)
    (anonymous) @ ajax.js?v=10.1.2:1027
    Drupal.Ajax.commandExecutionQueue @ ajax.js?v=10.1.2:1024
    Drupal.Ajax.success @ ajax.js?v=10.1.2:1081
    processReplacement @ big_pipe.js?v=10.1.2:83
    checkMutationAndProcess @ big_pipe.js?v=10.1.2:99
    (anonymous) @ big_pipe.js?v=10.1.2:111
    processMutations @ big_pipe.js?v=10.1.2:110
    drupal.js?v=10.1.2:64 Uncaught TypeError: $(...).once is not a function
        at Object.attach (cshs.ts:14:10)
        at drupal.js?v=10.1.2:166:24
        at Array.forEach (<anonymous>)
        at Drupal.attachBehaviors (drupal.js?v=10.1.2:162:34)
        at HTMLAnchorElement.<anonymous> (ajax.js?v=10.1.2:1362:20)
        at Function.each (jquery.min.js?v=3.7.0:2:3129)
        at ce.fn.init.each (jquery.min.js?v=3.7.0:2:1594)
        at Drupal.AjaxCommands.insert (ajax.js?v=10.1.2:1360:21)
        at ajax.js?v=10.1.2:1034:41
    attach @ cshs.ts:14
    (anonymous) @ drupal.js?v=10.1.2:166
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ ajax.js?v=10.1.2:1362
    each @ jquery.min.js?v=3.7.0:2
    each @ jquery.min.js?v=3.7.0:2
    insert @ ajax.js?v=10.1.2:1360
    (anonymous) @ ajax.js?v=10.1.2:1034
    setTimeout (async)
    Drupal.throwError @ drupal.js?v=10.1.2:63
    (anonymous) @ drupal.js?v=10.1.2:168
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ ajax.js?v=10.1.2:1362
    each @ jquery.min.js?v=3.7.0:2
    each @ jquery.min.js?v=3.7.0:2
    insert @ ajax.js?v=10.1.2:1360
    (anonymous) @ ajax.js?v=10.1.2:1034
    Promise.then (async)
    (anonymous) @ ajax.js?v=10.1.2:1027
    Drupal.Ajax.commandExecutionQueue @ ajax.js?v=10.1.2:1024
    Drupal.Ajax.success @ ajax.js?v=10.1.2:1081
    processReplacement @ big_pipe.js?v=10.1.2:83
    checkMutationAndProcess @ big_pipe.js?v=10.1.2:99
    (anonymous) @ big_pipe.js?v=10.1.2:111
    processMutations @ big_pipe.js?v=10.1.2:110
    drupal.js?v=10.1.2:64 Uncaught TypeError: $(...).once is not a function
        at Object.attach (cshs.ts:14:10)
        at drupal.js?v=10.1.2:166:24
        at Array.forEach (<anonymous>)
        at Drupal.attachBehaviors (drupal.js?v=10.1.2:162:34)
        at HTMLUListElement.<anonymous> (ajax.js?v=10.1.2:1362:20)
        at Function.each (jquery.min.js?v=3.7.0:2:3129)
        at ce.fn.init.each (jquery.min.js?v=3.7.0:2:1594)
        at Drupal.AjaxCommands.insert (ajax.js?v=10.1.2:1360:21)
        at ajax.js?v=10.1.2:1034:41
    attach @ cshs.ts:14
    (anonymous) @ drupal.js?v=10.1.2:166
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ ajax.js?v=10.1.2:1362
    each @ jquery.min.js?v=3.7.0:2
    each @ jquery.min.js?v=3.7.0:2
    insert @ ajax.js?v=10.1.2:1360
    (anonymous) @ ajax.js?v=10.1.2:1034
    setTimeout (async)
    Drupal.throwError @ drupal.js?v=10.1.2:63
    (anonymous) @ drupal.js?v=10.1.2:168
    Drupal.attachBehaviors @ drupal.js?v=10.1.2:162
    (anonymous) @ ajax.js?v=10.1.2:1362
    each @ jquery.min.js?v=3.7.0:2
    each @ jquery.min.js?v=3.7.0:2
    insert @ ajax.js?v=10.1.2:1360
    (anonymous) @ ajax.js?v=10.1.2:1034
    Promise.then (async)
    (anonymous) @ ajax.js?v=10.1.2:1027
    Drupal.Ajax.commandExecutionQueue @ ajax.js?v=10.1.2:1024
    Drupal.Ajax.success @ ajax.js?v=10.1.2:1081
    processReplacement @ big_pipe.js?v=10.1.2:83
    checkMutationAndProcess @ big_pipe.js?v=10.1.2:99
    (anonymous) @ big_pipe.js?v=10.1.2:111
    processMutations @ big_pipe.js?v=10.1.2:110
    drupal.js?v=10.1.2:64 Uncaught TypeError: $(...).once is not a function
        at Object.attach (cshs.ts:14:10)
        at drupal.js?v=10.1.2:166:24
        at Array.forEach (<anonymous>)
        at Drupal.attachBehaviors (drupal.js?v=10.1.2:162:34)
        at drupal.init.js?v=10.1.2:32:12
        at HTMLDocument.listener (drupal.init.js?v=10.1.2:20:7)
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium tim-diels Belgium ๐Ÿ‡ง๐Ÿ‡ช

    @mfuggle looks like the patch from the MR isn't applied successfully on your code. As otherwise the error would be gone.
    Can you check the code in your project and see the code is changed to what is in the MR?

    And make sure you cleared the site cache but also the browser cache...

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    we're using Drupal 10.0.10 , I've tried both the MR13 and the patch 12 , both have the same errors as described in #22
    Uncaught TypeError: $(...).once is not a function
    coming from cshs.js / cshs.ts

    I'm not familiar with the compiling methods used here.
    Hopefully an improved patch will come soon.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    Setting back to "Needs work"

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    Sorry , my bad, as mentioned by @smulvih2 hard reset was needed, the browser was greedily caching, the patch #12 works great thanks so much!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States joshuami Portland, OR

    +1 on the RTBC. I also had the caching issue, and I *think* it is related to https://www.drupal.org/project/drupal/issues/3370828 ๐Ÿ› Ensure that edge caches are busted on deployments for css/js aggregates Fixed .

    As of Drupal 10.1.2, the cache tag on CSS and JS libraries are only going to get updated if there is a library version change. If the libraries file were updated to have a set version per release (or included in a patch for future release) it should make the cache tag parameter resetโ€”whether for a local build with aggregation turned off or for a production environment with aggregation turned on.

    I was able to get around this by including the patch in a build that also updated to Drupal 10.1.3โ€”which has version changes that trigger the new cache tag.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States alfattal Minnesota

    Patch in #12 fixed the issue for me. +1 on the RTBC.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada mandclu

    +1 for RTBC. I agree that the Drupal version compatibility should be updated to reflect when Drupal's once library was added, so my vote would be for MR13.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    Setting back to NW for code quality.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฆ๐Ÿ‡ทArgentina hanoii ๐Ÿ‡ฆ๐Ÿ‡ทUTC-3

    I fixed it but apparently I can't resolve the thread. @jwilson3 maybe you can?

  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    The instructions here do not work for me:

    https://docs.gitlab.com/ee/user/discussions/#resolve-a-thread

    It appears that the only people who can resolve the thread are:

    1. the original person who created the MR (i.e. @ignaciolflores), or
    2. a person with commit access on the project (i.e. one of the maintainers).

    https://drupal.slack.com/archives/CGKLP028K/p1681419829313849

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States robphillips

    +1 RTBC

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia timfletcher

    Any word on when this fix will be merged to 4.x? I'm planning a D10 rollout and want to know if it's worth holding off.
    Thanks for fixing!

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    @timfletcher

    I'm guessing the maintainers all need to be contacted. Find them on the project page, copy a link to this issue and ask them to please take action and also tag/release a fix.

    Meanwhile mamy have reported success with #12
    #3347581-12: Drupal 10 proper once dependency โ†’
    https://www.drupal.org/files/issues/2023-05-22/3347581-module-is-not-wor... โ†’

    If you want a patch from the MR (merge request) then please try this:
    https://git.drupalcode.org/project/cshs/-/merge_requests/13.patch

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States kwfinken Lansing, MI

    It has been over 6 months without a merge, is this an abandoned project?

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    @kwfinken
    Opportunity knocks, here's the process โ†’ .

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom fonant

    Patch #12 works to fix the problem for me.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    Patch #12 works for me to fix the problem.

    +1 on the RTBC.

  • ๐Ÿ‡ฎ๐Ÿ‡ธIceland drupalviking

    I can concurr that the module breaks in D10 and this patch fixes the problem.

  • ๐Ÿ‡ฟ๐Ÿ‡ฆSouth Africa matthew gibbon South Africa KZN

    As a site builder. I have tried following relevant instructions. Still unable to get this patch and module to work. Any advice appreciated.

    In composer.json

    "extra": {
    "composer-exit-on-patch-failure": true,
    "patchLevel": {
    "drupal/core": "-p2",
    "drupal/contrib-module1": "-p1",
    "drupal/contrib-module2": "-p1"
    },
    "patches": {
    "drupal/core": {
    "3212792: Views button hover effect is odd": " https://www.drupal.org/files/issues/2023-05-22/3347581-module-is-not-wor... โ†’ "
    }
    },

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    @Matthew Gibbon Replace โ€œdrupal/coreโ€ with โ€œdrupal/cshsโ€

  • ๐Ÿ‡ฟ๐Ÿ‡ฆSouth Africa matthew gibbon South Africa KZN

    Thank you. I have succeeded after learning about installing patches with composer and added the following after "installer-paths": { * }

    "patches":{
    "drupal/cshs":{
    "Fix cshs in D10":"https://git.drupalcode.org/project/cshs/-/merge_requests/13.diff"
    }
    },

    That being said Chrome holds the problems in client-side still and ignores the patch. I had to CLI into my mac after deleting chrome and many folders deep in library delete cache. This then solved the problem and patch worked.

    I am now trying to see if their is a way server side to renew/invalidate/delete client-side cache to simplify problem resolution. I am not this smart yet, so open to ideas?

  • Status changed to Fixed 10 months ago
  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    Merci Joseph! ๐ŸŽ‰

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

Production build 0.71.5 2024