Assertion failure in component update when required prop already exists in both versions
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3577603. --> Reported by: [mglaman](https://www.drupal.org/user/2416470) Related to !692 >>> <p><code>GeneratedFieldExplicitInputUxComponentInstanceUpdater::updateComponentInstanceProps()</code> unconditionally loads default explicit input and asserts its validity for <em>all</em> required props, even when no update is needed. This causes an assertion failure when a required prop (such as an entity reference image field) exists in both the <code>from</code> and <code>to</code> versions and already has a user-provided input, but lacks an example value in the component metadata.</p> <p>In the original code, <code>$default_explicit_input</code> is loaded and the assertion runs at the top of the loop for all required props, <em>before</em> the conditional branches that determine whether a default value is actually needed. The default value is only used in two cases:</p> <ol> <li>A new required prop (didn't exist in the <code>from</code> version)</li> <li>A prop that changed from optional to required and has no existing input</li> </ol> <p>If the prop existed in both versions and already has an input, the default value is never used; but, the assertion still fires and fails:</p> <pre><pre>assert(array_key_exists('value', $default_explicit_input[$prop_name]) &amp;&amp;<br>&nbsp; $default_explicit_input[$prop_name]['value'] !== NULL)<br>&nbsp; </pre></pre><h3 id="proposed-resolution">Proposed resolution</h3> <p>Move the <code>getDefaultExplicitInput()</code> call and the assertion into the two conditional branches where the default value is actually needed, rather than running them unconditionally for all required props.</p> <h3 id="ui-changes">User interface changes</h3> <p>None.</p> > Related issue: [Issue #3579086](https://www.drupal.org/node/3579086)
issue