1
0
forked from wrenn/wrenn

Harden file browser: cap preview lines, fix race conditions, download UX

- Cap text preview at 5,000 lines with truncation footer and download link
  to prevent browser freeze on large files (300k+ DOM nodes)
- Add request generation counters to discard stale API responses from
  rapid directory/file clicking
- Guard initial $effect with hasInitiallyLoaded to prevent double-load
- Add download loading state with spinner and disabled button
- Delay URL.revokeObjectURL by 5s so browser can start download
This commit is contained in:
2026-04-11 05:43:32 +06:00
parent d2202c4f49
commit cf191ca821
2 changed files with 46 additions and 14 deletions

View File

@ -120,5 +120,6 @@ export async function downloadFile(sandboxId: string, path: string, filename: st
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
// Delay revocation so the browser has time to start the download
setTimeout(() => URL.revokeObjectURL(url), 5000);
}