fix(ui): StartupLogPanel — defensive scrollTo + disable buttons while fetching

This commit is contained in:
hsiegeln
2026-04-23 16:05:35 +02:00
parent fb7b15f539
commit 2c0cf7dc9c

View File

@@ -24,7 +24,7 @@ export function StartupLogPanel({ deployment, appSlug, envSlug, className }: Sta
const scrollToLatest = () => { const scrollToLatest = () => {
const el = scrollRef.current; const el = scrollRef.current;
if (!el) return; if (!el || typeof el.scrollTo !== 'function') return;
// asc → latest at bottom; desc → latest at top // asc → latest at bottom; desc → latest at top
const top = sort === 'asc' ? el.scrollHeight : 0; const top = sort === 'asc' ? el.scrollHeight : 0;
el.scrollTo({ top, behavior: 'smooth' }); el.scrollTo({ top, behavior: 'smooth' });
@@ -57,6 +57,7 @@ export function StartupLogPanel({ deployment, appSlug, envSlug, className }: Sta
<Button <Button
variant="ghost" variant="ghost"
size="sm" size="sm"
disabled={query.isFetching}
onClick={() => setSort((s) => (s === 'asc' ? 'desc' : 'asc'))} onClick={() => setSort((s) => (s === 'asc' ? 'desc' : 'asc'))}
title={sort === 'asc' ? 'Oldest first' : 'Newest first'} title={sort === 'asc' ? 'Oldest first' : 'Newest first'}
aria-label={sort === 'asc' ? 'Oldest first' : 'Newest first'} aria-label={sort === 'asc' ? 'Oldest first' : 'Newest first'}
@@ -66,6 +67,7 @@ export function StartupLogPanel({ deployment, appSlug, envSlug, className }: Sta
<Button <Button
variant="ghost" variant="ghost"
size="sm" size="sm"
disabled={query.isFetching}
onClick={handleRefresh} onClick={handleRefresh}
title="Refresh" title="Refresh"
aria-label="Refresh" aria-label="Refresh"