Replace arbitrary wait in attachBehaviorsAfterAjaxing with an occurence based one

Created on 12 February 2025, 3 months ago

Postponed on 🐛 Image can only be replaced one time before "add media" stops working Active

Overview

In 🐛 Image can only be replaced one time before "add media" stops working Active we added a 30ms timeout to one of the calls to attachBehaviorsAfterAjaxing in ajax.hyperscriptify.js. This was done to delay a call to Drupal.attachBehaviors which addressed the media library "add media" button not reliably working. This seems to occur after it is reintroduced to the form by removing a prior media item without being accompanied by a react refresh. The process triggers Drupal.attachBehaviors , but it will not properly work with the button unless that behavior attachment is slightly delayed.

The 30ms was chosen because it's short enough to have no perceivable slowness, yet it's 6x longer than the 5ms required to get things working on my local setup, so that should be sufficient padding to account for different system speeds.

Although this works, it would be better to base the wait by checking for the end of the actual process preventing Drupal.attachBehaviors from working, and that's what should happen in this issue

Proposed resolution

User interface changes

📌 Task
Status

Active

Version

0.0

Component

Page builder

Created by

🇺🇸United States bnjmnm Ann Arbor, MI

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

Comments & Activities

Production build 0.71.5 2024