Code Component: Prop Type Change Fails to Reset Configuration
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3583386. -->
Reported by: [vipin.mittal18](https://www.drupal.org/user/319716)
Related to !875
>>>
<p>While configuring a code component, changing the prop type does not reset the previously applied configuration. For example, if a user initially selects Formatted Text and configures it, then changes the prop type to Link, the previous configuration persists and gets merged with the new type configuration.</p>
<p>This results in:</p>
<ul>
<li>Incorrect or mixed configuration being saved</li>
<li>Inconsistent behavior in the component setup</li>
<li>Broken or disturbed rendering on the front end</li>
</ul>
<p>This issue is generic and not limited to multi-value props. It affects all prop types where configuration settings differ. The system should ensure that whenever a prop type is changed, all previously associated configurations are cleared and reset to default for the newly selected type.</p>
<p><strong>Steps to Reproduce<br>
</strong></p>
<ol>
<li>Open Code Component Editor</li>
<li>Navigate to Component Data and ensure the Props tab is selected</li>
<li>Add a new prop</li>
<li>Select prop type as Formatted Text</li>
<li>Configure the prop (e.g., add prop name)</li>
<li>Change the prop type to Link</li>
<li>Configure link-related settings</li>
<li>Save the component</li>
<li>Observe the saved configuration and front-end rendering</li>
</ol>
<p><strong>Actual Result<br>
</strong></p>
<ul>
<li>Previous configuration (Formatted Text) persists even after changing to Link</li>
<li>Mixed or invalid configuration is saved</li>
<li>Front-end display is inconsistent or broken</li>
<li>
</ul>
<p><strong>Expected Result<br>
</strong></p>
<ul>
<li>Changing the prop type should completely reset all previous configurations</li>
<li>Only the configuration relevant to the newly selected prop type should be available and saved</li>
<li>Front-end rendering should reflect only the correct configuration for the selected prop type</li>
<li>
</ul>
<p><strong>Acceptance Criteria<br>
</strong></p>
<ul>
<li>When a prop type is changed, all previous configurations are cleared automatically</li>
<li>Default configuration for the newly selected prop type is applied</li>
<li>No residual or mixed configuration from previous types is retained</li>
<li>Saved configuration strictly matches the selected prop type</li>
<li>Front-end rendering is consistent and correct after prop type changes</li>
<li>This behavior is consistent across all prop types (not limited to multi-value props)</li>
</ul>
> Related issue: [Issue #3571917](https://www.drupal.org/node/3571917)
> Related issue: [Issue #3572553](https://www.drupal.org/node/3572553)
issue