Problem/Motivation
After Generate in the Media Library dialog opened from a node form, the node form's Save stops working. It posts ?ajax_form=1 and shows "Oops, something went wrong." Edits are lost. Picking an existing item without Generate keeps Save working.
Cause: the Generate request is htmx, so core does not make ids unique, and the library's "Insert selected" renders as a plain #edit-submit whose ajax settings bind the node form's Save.
Steps to reproduce
- Open a node add form with a media field.
- Click Add media, then Generate with AI.
- Click Generate, then Insert selected.
- Click Save.
Proposed resolution
Render the htmx response with unique ids, as an AJAX request would, or scope the ajax settings it adds. Add a functional test.
Remaining tasks
- ✅ File an issue
- ❌ Addition/Change/Update/Fix
- ❌ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support
- ➖ User Guide Documentation support
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ✅ Update Release Notes
- ✅ Release
User interface changes
- Before (1.0.x): Save after Generate and Insert selected fails with "Oops, something went wrong".

- After: the article saves with the generated image.

API changes
- N/A
Data model changes
- N/A
Release notes snippet
- N/A
AI-Generated: Yes
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3634856-after.png | 83.48 KB | rajab natshah |
| #3 | 3634856-before.png | 58.53 KB | rajab natshah |
Issue fork ai_media-3634856
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rajab natshahComment #5
rajab natshah✅ Released ai_media-1.0.0-rc1