Fix crash when non iterable options property given to picker

This commit is contained in:
Andrew Kingston 2021-04-16 13:08:06 +01:00
parent 359588592e
commit ff9824011a
1 changed files with 20 additions and 17 deletions

View File

@ -68,6 +68,7 @@
</svg>
</li>
{/if}
{#if options && Array.isArray(options)}
{#each options as option}
<li
class="spectrum-Menu-item"
@ -76,7 +77,8 @@
aria-selected="true"
tabindex="0"
on:click={() => onSelectOption(getOptionValue(option))}>
<span class="spectrum-Menu-itemLabel">{getOptionLabel(option)}</span>
<span
class="spectrum-Menu-itemLabel">{getOptionLabel(option)}</span>
<svg
class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
focusable="false"
@ -85,6 +87,7 @@
</svg>
</li>
{/each}
{/if}
</ul>
</div>
{/if}