Video multivalue props throw "Cannot read properties of undefined (reading 'endsWith')" error when switching to Limited mode
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3582772. -->
Reported by: [kunal.sachdev](https://www.drupal.org/user/3685163)
Related to !854
>>>
<h3 id="overview">Overview</h3>
<p>When "Allow multiple values" is enabled for a video prop in the Canvas code component editor and then "Limited" option is selected from Limited/Unlimited" dropdown, an error is thrown : 'Cannot read properties of undefined (reading 'endsWith')'. This prevents the limited mode from being activated and breaks the user interface.</p>
<p>The root cause is that the limited mode initialization logic fills arrays with empty strings ('') as placeholder values for all prop types. However, video and image props expect objects. When the serialization function attempts to process these empty strings as video objects, it fails when trying to access the src property.</p>
<h3 id="proposed-resolution">Steps to Reproduce</h3>
<ol>
<li>Navigate to Canvas code component editor</li>
<li>Create a new code component or edit an existing one</li>
<li>Add a new prop or edit an existing prop</li>
<li>Set the prop type to "Video"</li>
<li>Check the "Allow multiple values" checkbox (requires dev mode to be enabled)</li>
<li>In the "Limited/Unlimited" dropdown that appears, select "Limited"</li>
<li>Observe the error message: "An unexpected error has occurred. Cannot read properties of undefined (reading 'endsWith')"</li>
</ol>
<p><strong>Expected Result:</strong> The prop should successfully switch to limited mode with a default count of 2 items, and the UI should remain functional.</p>
<p><strong>Actual Result:</strong> A JavaScript error is thrown, breaking the UI and preventing the mode switch.</p>
issue