Issue with missing attributes in Select component (i.e. Ajax Failures)

Created on 23 April 2024, 8 months ago
Updated 8 May 2024, 8 months ago

Problem/Motivation

With the build dev-6.0.x 15a8615 the select component was missing attributes present in the array when invoked.

This has led to issues where anything that relied on said attributes (such as a default Ajax call in drupal commerce) was failing, as there was nothing to bind a change event to.

Steps to reproduce

Install D10 2.5.x
Install Drupal Commerce 2.x
Install Radix.

Create a product with two variations, when switching variations, Ajax does not fire (i.e. price does not update)

If you were then to switch theme (say to Olivero), this will start working.

Proposed resolution

As discussed in slack: https://drupal.slack.com/archives/C0227KG45KN/p1713810972086429 , the twig template was creating a new array, and not passing over data such as the ID etc. Switching the twig statement to:

{% set select_attributes = attributes ?: create_attribute() %}

Uses the existing attributes if present, and creates a new object if not.

Merge request to follow.

🐛 Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

🇬🇧United Kingdom martin@manarock.co.uk

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024