Problem/Motivation

Config fields are split between two classes:

- FieldConfigBase, in the Field core component
- FieldConfig, which inherits from it, in the field module.

FieldConfigBase handles clearing caches on save, in postSave():

    // Clear the cache.
    \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();

However, for deleting a field, it's in FieldConfig::postDelete():

    // Clear the cache upfront, to refresh the results of getBundles().
    \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();

    // Notify the entity storage.
    foreach ($fields as $field) {
      if (!$field->deleted) {
        \Drupal::service('field_definition.listener')->onFieldDefinitionDelete($field);
      }
    }

This part of the code in postDelete() should be moved up to the parent class for consistency.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

joachim created an issue. See original summary.

joaopauloc.dev’s picture

Assigned: Unassigned » joaopauloc.dev
StatusFileSize
new1.85 KB
joaopauloc.dev’s picture

Assigned: joaopauloc.dev » Unassigned
Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Seems like a simple clean up.

Only question for committer does this need a CR? Doubt it but wanted to make sure.

  • catch committed 4aa36600 on 10.1.x
    Issue #3336639 by joaopauloc.dev, joachim: Move cache clearing in...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Don't think we need a CR for this one, but will only commit to 10.1.x.

Committed/pushed to 10.1.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.