AJAX Command Feature to apply only if the selector not exist

Created on 20 August 2022, over 2 years ago
Updated 14 April 2024, 9 months ago

Problem/Motivation

I want to display a status message in dialog form which is not render at the time of form built but in the form validation if some error occurs it needs to show error status message in form but if the user clicks again on the form the status message is
appended twice in the form.

Steps to reproduce

I am checking on this issue 🐛 Error: Call to a member function uuid() on null in Drupal\media_library\MediaLibraryEditorOpener->getSelectionResponse() (line 72 of /app/docroot/core/modules/media_library/src/MediaLibraryEditorOpener.php) Needs work where I need this feature.

Proposed resolution

  1. To add an extra parameter exist in AppendCommand, PrependCommand ajax-commands to check and perform only if the selector is not exist.
  2. If the selector exist then replace it with the given response.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

11.0 🔥

Component
Ajax 

Last updated 1 day ago

Created by

🇮🇳India Jaykumar95 Ahmedabad

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom joachim

    I'm going to set this as needs work, since there's code here, even if it needs to be turned into a proper MR.

    I'm not a FE or JS developer, but this looks a bit iffy to me -- it's making the Insert command *sometimes* behave as a Replace. I think I'd rather we added a third InsertOrUpdate command to handle this case.

Production build 0.71.5 2024