fix: guard iteration picker VirtualList against empty items array (#8273)

When a flow loops over an empty array, the VirtualList component crashes
trying to access index 0 in an empty range. Add a guard to only render
VirtualList when items.length > 0, showing a "No iterations" message
otherwise.

Fixes #8272

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude[bot]
2026-03-09 08:19:33 +00:00
committed by GitHub
co-authored by claude[bot] windmill-internal-app[bot] Claude Opus 4.6
parent 5ba4029d86
commit c97cf604ab
@@ -142,6 +142,7 @@
<div class="max-h-[300px]">
{#key items}
{#if items.length > 0}
<VirtualList height={300} width="100%" itemCount={items.length} itemSize={24}>
{#snippet header()}{/snippet}
{#snippet footer()}{/snippet}
@@ -170,6 +171,9 @@
</div>
{/snippet}
</VirtualList>
{:else}
<div class="text-xs text-tertiary py-2 px-2">No iterations</div>
{/if}
{/key}
<!-- {#each flowJobs ?? [] as id, idx (id)}