Formstate storage is not cleared for IEF entities that are cancelled or removed causing display of stale data

Created on 14 February 2024, 10 months ago

Problem/Motivation

After an IEF form is cancelled or an item is removed the inline_entity_form storage is not cleared properly for that field.

If entity reference fields are used inside the edited entity then previously filled in entity reference fields will show inside the IEF entity, even though we are creating a new entity,

Steps to reproduce

  1. Standard Drupal installation
  2. Create an entity reference field with ief widget inside article that allows both basic pages and articles
  3. Create an article with an article inside with an article inside (root level + 2 levels deep)
  4. Cancel the first level IEF widget
  5. Create a new entity
  6. This new entity will reference the entity reference from the previously canceled article

The same behavior occurs when deleting the inline entity.

I've tested this with bundle selection.

Proposed resolution

On 'cancel' and 'delete' actions, the form state storage for that field and all underlying ief fields should be cleared.

Remaining tasks

Tests. Find out where this should be fixed.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇪🇸Spain nuez Madrid, Spain

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

Merge Requests

Comments & Activities

  • Issue created by @nuez
  • Status changed to Needs review 10 months ago
  • 🇪🇸Spain nuez Madrid, Spain
  • Merge request !110Fix clearing form state. → (Open) created by nuez
  • Pipeline finished with Success
    10 months ago
    Total: 467s
    #94615
  • Pipeline finished with Success
    10 months ago
    Total: 461s
    #94672
  • Pipeline finished with Success
    10 months ago
    Total: 417s
    #94698
Production build 0.71.5 2024