Problem/Motivation

I have a pargraph type with a ER field to a instagram/twitter media entity. The media is displayed with the IEF simple widget.
I create a paragraph of that type, leave it empty and remove it. Then I save my node. After that an empty media entity was created.

I don't have the problem when I use the complex widget.

Command icon 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

chr.fritsch created an issue. See original summary.

chr.fritsch’s picture

Status: Active » Needs review

This seems to work, but I am not sure if I break something else with it.

benstallings’s picture

Status: Needs review » Needs work

Concerns

1. No test. A regression test in tests/src/FunctionalJavascript/SimpleWidgetTest.php exercising an AJAX round-trip (e.g., a field sibling triggering AJAX without the main submit) and verifying the referenced entity isn't corrupted would be worth having. The Complex widget has this guard for a reason; the same failure mode should be covered for Simple.

2. Quiet regression risk. By parity with Complex this is almost certainly safe, but worth confirming that no current IEF flow relies on Simple's extractFormValues populating widget state during AJAX rebuilds. The Complex widget's long-standing guard suggests the answer is no.

Recommendation

The fix is correct and minimal — it just makes Simple match Complex's well-established behavior. But before merging:
1. Add a regression test.
2. Optional: one-line comment noting the guard mirrors InlineEntityFormComplex.

benstallings’s picture

Assigned: Unassigned » benstallings
benstallings’s picture

Assigned: benstallings » Unassigned
Status: Needs work » Needs review