Validation of unexisting fields on paragraphs actions
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3571033. -->
Reported by: [aaron gil martinez](https://www.drupal.org/user/3605526)
Related to !1150
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>When a node form uses Paragraphs, the AI Content Suggestions “Select the field(s) you wish to send to the LLM” list does not update after Paragraphs AJAX actions (collapse/edit/add). This makes it possible to select stale/hidden paragraph fields or miss newly added ones or even display errors because of validation on non-existing fields in the list.</p>
<h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4>
<ol>
<li>Enable ai_content_suggestions + paragraphs.</li>
<li>Create a content type with a Paragraphs field and a Paragraph bundle containing a text field.</li>
<li>Create content with one paragraph and open the edit form.</li>
<li>Open “Alter tone” and toggle the field selector list.</li>
<li>Collapse/edit/add paragraphs.</li>
<li>Fields in the list are not valid anymore.</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Wrap Paragraphs widget AJAX callbacks and refresh the target_fields select (via an AJAX ReplaceCommand on the select wrapper), so options are rebuilt after any Paragraphs AJAX action.</p>
issue