Module breaks or blocks other javascript

Created on 9 November 2023, 8 months ago
Updated 23 November 2023, 7 months ago

Problem/Motivation

On a Drupal 10.1 site, running Drupal Commerce, my add to cart form JavaScript is not firing when this module is enabled. However, once a session is established (login or cart session), the cart JavaScript works fine.

Steps to reproduce

Drupal 10, enable this module and sub-module, visit a commerce form with ajax like the add to cart form. Change a form element, see no ajax fire.

Proposed resolution

This appears to be related to the libraries `head: true` property as removing this fixes the issue.

Remaining tasks

Confirm, review by others, test...

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code (General)

Created by

πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

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

Comments & Activities

  • Issue created by @andyg5000
  • Status changed to Needs review 8 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update 8 months ago
    Patch Failed to Apply
  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    Here's a patch that's fixing the issue for me.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update 8 months ago
    23 pass
  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA
  • πŸ‡ΊπŸ‡ΈUnited States loze

    Im getting the following error when adding a product to the cart with ajax, both with and without this patch.

    If i disable the module it goes away.

    I'm using Drupal 9.5.11

    "
    An AJAX HTTP error occurred.
    HTTP Result Code: 200
    Debugging information follows.
    Path: /event/365052?ajax_form=1
    StatusText: OK
    ResponseText: TypeError: Drupal\commerce\Context::__construct(): Argument #1 ($customer) must be of type Drupal\Core\Session\AccountInterface, null given, called in /Users/XXXXX/web/modules/contrib/commerce/modules/cart/src/Form/AddToCartForm.php on line 248 in Drupal\commerce\Context->__construct() (line 58 of /Users/XXXXX/web/modules/contrib/commerce/src/Context.php)."

Production build 0.69.0 2024