When editing a Canvas entity with a component tree (e.g., page, template, or region), automatically upgrade component instance versions for cases where there's no impact on existing data
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3567413. --> Reported by: [effulgentsia](https://www.drupal.org/user/78040) Related to !485 >>> <h3 id="overview">Overview</h3> <p>The <code>active_version</code> of a <code>Component</code> config entity can change due to a number of reasons, such as:</p> <ul> <li>A code update that includes changed schema for an SDC.</li> <li>Within the Canvas UI, a Code Component author changes their prop or slot definitions (once <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3509115" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3509115</a></span> makes that possible).</li> <li>A module that implements <code>hook_canvas_storable_prop_shape_alter()</code> is installed or uninstalled.</li> </ul> <p><span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3463996" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3463996</a></span> is tacking more difficult cases, but there are quite a few cases where the change to the <code>active_version</code> has 0 repercussions for component instance data saved for an older version:</p> <ul> <li>An optional prop is added</li> <li>A slot is added</li> <li>A prop was changed from required to optional</li> <li>The <code>default_value</code> within one of the <code>prop_field_definitions</code> got changed</li> <li>The example values of a slot got changed</li> </ul> <p>For all of the above cases, we can update the component instances to the new component version without having to do anything other than simply marking them with the new version.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <ul> <li>Whenever a component instance is edited (TBD for exactly which UI interaction / API call this refers to), if it's currently referencing an old component version, and the component's active version consists of solely the changes listed above, then automatically update its version marker to the new version upon saving the data to auto-save storage.</li> <li>Note that for this issue, we do not need to bulk update multiple entities. We can simply do it one entity at a time when that entity is edited.</li> </ul> <h3 id="ui-changes">User interface changes</h3> <p>None &mdash;&nbsp;other than new image media types appearing immediately on all existing component instances that have "image" props:<br> <img src="https://www.drupal.org/files/issues/2026-02-05/instantly%20more%20image%20media%20types.gif"></p>
issue