- Issue created by @vangelisp
- 🇬🇧United Kingdom vangelisp Fife, Scotland
Coming back to this issue, I was able to identify how this issue/console error gets triggered.
On my main theme, I have the dependency:
- core/jquery.once
instead of- core/once
.That means that if we don't explicitly define in the
webform_civicrm.libraries.yml
that we want the dependencycore/once
for each js library that we're using, the webform will use the one of the theme (parent), which (in my case) wascore/jquery.once
.My personal take on this is that we should enforce the proper dependencies so as to avoid any potential situations like mine, although I don't know how many people continue to use the old dependency
core/jquery.once
. - 🇨🇦Canada karing 🇨🇦
D8 has been end of life for a very long time. It is not supported.
- Assigned to jitendrapurohit
- 🇬🇧United Kingdom kenorb
This seems to happen in webform_civicrm_admin.js and webform_civicrm_options.js. At the bottom of the script it's using
})(Drupal, jQuery, once);
I've added:
admin: dependencies: - core/jquery - core/once
to webform_civicrm.libraries.yml as suggested, but didn't seems to help.
- 🇬🇧United Kingdom kenorb
Workaround for Drupal 8.x:
1. Add js/once.js into your theme from https://www.drupal.org/project/once → (https://git.drupalcode.org/project/once/-/blob/v1.0.1/src/once.js?ref_ty...).
2. Load it as dependency in your_theme.libraries.ymlglobal-components: js: js/custom.js: {} js/once.js: {}
- 🇮🇳India jitendrapurohit
It looks like the core/once library was added in https://github.com/colemanw/webform_civicrm/pull/773 already? I cant replicate the console error on my instance.
Also, we have test running on github which i think also captures any console errors.
The test is configured to run against drupal version 9.4, 9.5 & v10 and none of them fails with a js error.
Do you mean its only failing for Drupal 8?
- Status changed to Closed: cannot reproduce
over 1 year ago 1:03pm 14 May 2023 - 🇺🇸United States jptillman
Comment #7 doesn't work. Not only is once.js at the provided URL a module script that requires being loaded as a module, webform_civicrm doesn't even pick it up once it's loaded.