#ajax config not reliably implemented for consecutively added components

Created on 24 April 2025, about 21 hours ago

Overview

IF

  • If a component has an instance form with #ajax properties
  • And multiple instances of that component are consecutively* added to a layout

The form array's #ajax does not reliably apply the expected Drupal AJAX functionality.

If XB is refreshed, each component instance form's #ajax appears to work fine

* I'm not 100% sure it needs to be consecutive, but so far that's been the reliable way to reproduce it.

Steps to reproduce

  • Add 3 image components to the layout, consecutively
  • Note that the "Add media" button will work for some, but not all components
  • The "Add media" buttons that work have the data-once="drupal-ajax" attribute
  • Re-processing the components that don't work with Drupal.attachBehaviors() does not result in them working, so it's not a matter of triggering the behaviors again.

Proposed resolution

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Redux-integrated field widgets

Created by

🇺🇸United States bnjmnm Ann Arbor, MI

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

Merge Requests

Comments & Activities

  • Issue created by @bnjmnm
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Is this not at the Semi-coupled theme engine level? 🤔

  • Merge request !951#3520971 stop dummy props form cache → (Open) created by bnjmnm
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    The problem is due to Redux createAPI() caching requests to xb/api/form/component-instance -
    Any component form visited the first time will work.
    If the component form is revisited in the same page visit, it will return the cached version which does not have the same selectors as those in drupalSettings.ajax and the ajaxification of elements such as "Add media" does

    This is e2e testable but might be worth considering holding off on that since we might be switching testing libraries in the near future, and this is only a few lines in one file that can be manually tested pretty easily.

Production build 0.71.5 2024