diff -u b/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php --- b/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -296,6 +296,16 @@ // initial values. $dependency_manager = $this->getConfigDependencyManager(); $dependents = $this->findConfigEntityDependentsAsEntities($type, $names, $dependency_manager); + // Store the list in three variables so we can determine the how the + // dependency list has changed as things are fixed by calling the + // onDependencyRemoval() method. The variables are: + // - $dependents is the list of dependencies to process. This list changes + // as entities processed and are fixed or deleted. + // - $current_dependencies is the list of dependencies on $names. This list + // changes as entities processed and are fixed or deleted. This list is + // passed to onDependencyRemoval() as the list of affected entities. + // - $original_dependencies is the list of original dependencies on $names. + // This list never changes. $original_dependencies = $current_dependencies = $dependents; $affected_uuids = []; @@ -321,13 +331,14 @@ // Recalculate dependencies and update the dependency graph data. $dependent->calculateDependencies(); $dependency_manager->updateData($dependent->getConfigDependencyName(), $dependent->getDependencies()); - // Based on the updated data rebuild the list of dependents. This will - // remove entities that are no longer dependent after the recalculation. + // Based on the updated data rebuild the list of current dependencies. + // This will remove entities that are no longer dependent after the + // recalculation. $current_dependencies = $this->findConfigEntityDependentsAsEntities($type, $names, $dependency_manager); - $dependents = $current_dependencies; - // Remove any entities that we've already processed. - $dependents = array_filter($dependents, function ($dependent) use ($affected_uuids) { - return !in_array($dependent->uuid(), $affected_uuids); + // Rebuild the list of entities that we need to process by removing any + // entities that we've already processed. + $dependents = array_filter($current_dependencies, function ($current_dependency) use ($affected_uuids) { + return !in_array($current_dependency->uuid(), $affected_uuids); }); // Ensure that the dependency has actually been fixed. It is possible // that the dependent has multiple dependencies that cause it to be in reverted: --- b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -462,15 +462,6 @@ $changed = TRUE; } } - foreach (\Drupal::service('entity_field.manager')->getBaseFieldDefinitions($this->getTargetEntityTypeId()) as $field_name => $field_definition) { - if (in_array($field_definition->getProvider(), $dependencies['module'], TRUE)) { - // Remove components for base fields whose modules are being - // uninstalled. - $this->removeComponent($field_name); - unset($this->hidden[$field_name]); - $changed = TRUE; - } - } foreach ($this->getComponents() as $name => $component) { if ($renderer = $this->getRenderer($name)) { if (in_array($renderer->getPluginDefinition()['provider'], $dependencies['module'])) { diff -u b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php --- b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php @@ -316,10 +316,10 @@ ); $entity_4->save(); - // Entity 5 will be fixed because it is dependent on entity 3 which is - // unchanged and entity entity 1 but it can be fixed because + // Entity 5 will be fixed because it is dependent on entity 3, which is + // unchanged, and entity 1 which will be fixed because // \Drupal\config_test\Entity::onDependencyRemoval() will remove the - // dependency before config entities are deleted. + // dependency. $entity_5 = $storage->create( [ 'id' => 'entity_' . $entity_id_suffixes[4],