Preserve omitted optional props in Workbench mocks
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3585638. --> Reported by: [balintbrews](https://www.drupal.org/user/613760) Related to !938 >>> <h3 id="overview">Overview</h3> <p>Canvas Workbench currently treats component metadata example values as implicit mock defaults. When an authored mock omits an optional prop, Workbench backfills that prop from <code>examples</code> in <code>component.yml</code> instead of preserving the omission.</p> <p>This means authored mocks cannot reliably represent omission of an optional prop. In some cases, authors can pass an empty value, but that is not equivalent to an omitted prop and does not work cleanly for all prop types. This behavior affects both the live Workbench preview and the <code>preview-build</code> command.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Change Workbench mock normalization so metadata example values are only backfilled for required props. Optional props should remain omitted unless the authored mock explicitly provides them.</p> <p>The default preview should continue to use the full example props from component metadata, but authored mocks should preserve omission semantics so they accurately test absence and presence cases.</p> <h3 id="ui-changes">User interface changes</h3> <p>Workbench previews for authored mocks will stop rendering optional example-only values unless those props are explicitly present in the mock. The default preview behavior remains unchanged.</p>
issue