Content dependencies lost on export and importing again if the content entities do not exist

Created on 21 October 2015, almost 10 years ago
Updated 15 July 2025, 18 days ago

Problem/Motivation

Content dependencies are also soft dependencies. This missing that if they are missing then the configuration should not remove them if resaved. This means that if the content does not exist during configuration import and the config entity is created the content dependency should not be removed. For example, Block content blocks lose their dependencies when exported after being imported before the block content entity existed.

If I have a module that provides some block placements and default content for the block entities themselves, the block placements are imported first and then the block content. This is allowed because of the fallback plugin for blocks. If you immediately attempt to re-export the block placements, the dependencies will be lost.

Steps to reproduce

  1. Install Drupal with Standard profile
  2. Extract https://www.drupal.org/files/issues/2025-07-15/test_content.tar_.gz into a custom module folder
  3. drush en -y test_content
  4. drush config-get block.block.testblock
  5. Note, the content dependency has been lost, refer to config/install/block.block.testblock.yml
  6. Re-save "Test Block" on the blocks page.
  7. drush config-get block.block.testblock - Now shows the dependencies again.

Proposed resolution

Don't clear out content dependencies when recalculating configuration dependencies.

Remaining tasks

Discuss approach, review patch, add tests.

User interface changes

None

API changes

tba

Data model changes

tba

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component

block_content.module

Created by

🇦🇺Australia benjy

Live updates comments and jobs are added and updated live.
  • Triaged core major

    There is consensus among core maintainers that this is a major issue. Only core committers should add this tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia acbramley

    Confirmed this is still an issue on 11.x. Updating IS with the steps and uploading new module tarball that works on 11.x

Production build 0.71.5 2024