Drupal Canvas: changed a component's props? Export your config

Recently, one of my colleagues made what looked like a harmless change to a Single Directory Component (SDC) used by Drupal Canvas: they simply changed an enum in the component's props schema, then deployed to the dev environment.

The deployment failed during:

drush cim

with:

component entity is a versioned config entity, and its loaded version is not the active version

🔍 What happened?

Drupal Canvas doesn't rely directly on the *.component.yml file at runtime.

For each SDC used by Canvas, it maintains a Component config entity, for example:

canvas.component.sdc.<theme>.<component>

This entity keeps:

  • an active_version, based on a hash of the component's props schema;
  • a history of previous versions, so existing Canvas component instances can continue to work.

So when you modify a component schema — even something as simple as an enum — the component version changes.

After a cache rebuild, Canvas computes the new version and stores it in the database.

You can then end up with:

*.component.yml  →  new schema / new hash
config sync      →  old version
database         →  new active version

💥 And the next drush cim can fail because the configuration and the active Canvas component version no longer match.

✅ The rule I now follow

Whenever I change the schema of an SDC used by Canvas — props, slots, enums, defaults, etc.:

drush cr
drush cex

Then I commit both sides of the change together:

*.component.yml
canvas.component.sdc.*.yml

The component schema and its Canvas configuration are effectively two halves of the same change.

This also avoids having the generated Canvas version depend on which environment happened to run the last cache rebuild.

Small detail, but an important one when moving Drupal Canvas + SDC changes across environments.