From a8fa0cccef870f841c68be77832d9be12109badb Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 19 Mar 2026 05:49:44 +0000 Subject: [PATCH] fix: prevent S3 file browser crash when selecting storage (#8444) VirtualList crashes with 'Requested index 0 is outside of range 0..0' when it mounts with itemCount=0 and a positive height. This happened because the old condition allowed VirtualList to remount during loading with zero items but a stale listDivHeight from a previous mount. Change the guard to displayedFileKeys.length === 0 so VirtualList is never rendered when there are no items. Show a centered loading spinner or "no files" message instead. Co-authored-by: Claude Opus 4.6 (1M context) --- .../src/lib/components/S3FilePickerInner.svelte | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/components/S3FilePickerInner.svelte b/frontend/src/lib/components/S3FilePickerInner.svelte index 74b85bd327..9968c23180 100644 --- a/frontend/src/lib/components/S3FilePickerInner.svelte +++ b/frontend/src/lib/components/S3FilePickerInner.svelte @@ -592,10 +592,18 @@ {/if} - {#if fileListLoading === false && displayedFileKeys.length === 0} -
- No files in the workspace S3 bucket at that prefix -
+ {#if displayedFileKeys.length === 0} + {#if fileListLoading} +
+
+ Loading content +
+
+ {:else} +
+ No files in the workspace S3 bucket at that prefix +
+ {/if} {:else}