Overview
Reading https://git.drupalcode.org/project/canvas/-/merge_requests/399/diffs#not... for #3557272: BE: Support removing a slot from a code component made me review \Drupal\canvas\ComponentSource\ComponentSourceBase::generateVersionHash and specifically \Drupal\canvas\ComponentSource\ComponentSourceBase::normalizeSlotDefinitions.
I noticed that changing a slot title or examples causes a new component version.
Given this definition
slots:
content:
title: Content
description: Content to display below the greeting
examples:
- <div>Example slot content</div>
The normalized slot definitions would be:
[
'content' => [
'title' => 'Content',
'example' => '<div>Example slot content</div>',
],
]
I don't think it is reasonable to have the title or example be considered as they do not impact the component's usage.
Proposed resolution
Revise normalizeSlotDefinitions to only return the keys for slots in their defined order.
User interface changes
Comments
Comment #2
wim leersAgreed. Changing the slot machine name should trigger it, but not any of its metadata.
Thanks for reporting this! ❤️
Comment #3
wim leersComment #4
wim leers