Problem/Motivation

If an SDC is to be replaced by another SDC, their schema's must align. In the case of an SDC that does not declare props, it is impossible to replace it with one that does, unless the author of the original SDC adds an empty props object to the component.yml. The original SDC author may or may not be willing to add an empty props object to the SDC for their own reasons. (I've linked two issues to different projects, one maintainer was willing, the other not).

This hard requirement presents a paper cut, where a specific use-case might require props, but by being unable to add props to a replacing component necessitates actually creating a nearly identical SDC simply for the purpose of adding a prop. This results in code-bloat and potentially cognitive load for editors using components in a builder with "extra" components polluting the UI.

Steps to reproduce

Replace a component that has no props defined with one that does.

Proposed resolution

My super naive take: If a component does not declare props, dynamically inject an empty props object.

Remaining tasks

Determine if this is a reasonable approach.

User interface changes

Introduced terminology

API changes

Data model changes

Empty props where there were none?

Release notes snippet

Issue fork drupal-3633275

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

scottsawyer created an issue. See original summary.

grimreaper’s picture

Assigned: Unassigned » grimreaper

grimreaper changed the visibility of the branch 3633275-allow-replacing-components to hidden.

grimreaper changed the visibility of the branch 3633275-allow-replacing-components to active.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Active » Needs review

Hi,

I have generated a MR with Claude to speed up the fix on this issue to not leave @scottsawyer without solution for his project regarding the original report on https://git.drupalcode.org/project/ui_suite_bootstrap/-/work_items/3630724