fix: #3634856 Keep the host form's Save working after Generate in the Media Library dialog

Issue: https://www.drupal.org/project/ai_media/issues/3634856

Generate in the Media Library is an htmx request without _drupal_ajax, so its response rendered the library's "Insert selected" as a plain #edit-submit. Its ajax setting then bound the host form's Save to MediaLibrarySelectForm::updateWidget, and Save failed with "Oops, something went wrong".

Generate now posts _drupal_ajax=1 (hx-vals), so the response has unique ids as core's AJAX upload does. A Kernel assertion and a varbase-e2e scenario (save the article after Generate and insert) cover it.

Before: Save after Generate and Insert selected fails with "Oops, something went wrong".

Before

After: the article saves with the generated image.

After

AI-Generated: Yes

Checkpoints:

  • File an issue
  • Addition/Change/Update/Fix
  • Testing to ensure no regression
  • Automated unit testing coverage
  • Automated functional testing coverage
  • UX/UI designer responsibilities
  • Readability
  • Accessibility
  • Performance
  • Security
  • Developer Documentation
  • User Guide Documentation
  • Reviewed by human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Release notes snippet
  • Release

🤖 Generated with Claude Code

Edited by Rajab Natshah

Merge request reports

Loading
Loading