Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: keep the sidebar fade in sync on resize and centre the profile row (#7977)

Michael Han79003bf85fbd
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index 3d3ee250aef..f21448e8d31 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -655,7 +655,7 @@ export function AppSidebar() {
// Driven only from onScroll + a content-change effect below. No
// ResizeObserver: its callback-driven setState caused a render loop (React
// #185). Both setters bail out when unchanged, so neither path can loop.
- const syncScrollState = (el: HTMLDivElement) => {
+ const syncScrollState = useCallback((el: HTMLDivElement) => {
const nextScrolled = el.scrollTop > 0;
setScrolled((prev) => (prev === nextScrolled ? prev : nextScrolled));
const nextCanScrollDown =
@@ -663,7 +663,7 @@ export function AppSidebar() {
setCanScrollDown((prev) =>
prev === nextCanScrollDown ? prev : nextCanScrollDown,
);
- };
+ }, []);
const isRecipesRoute = pathname.startsWith("/data-recipes");
const isExportRoute = pathname === "/export" || pathname.startsWith("/export/");
@@ -904,8 +904,22 @@ export function AppSidebar() {
runsOpen,
pinnedOpen,
isStudioRoute,
+ // The update card grows the footer, so the scroll area shrinks under it.
+ showUpdateCard,
]);
+ // Resizing changes clientHeight without firing onScroll, so the fade would
+ // stay hidden while rows are still clipped. Window events only: no element
+ // observer, so this can't feed back into the loop that caused React #185.
+ useEffect(() => {
+ const onResize = () => {
+ const el = scrollRef.current;
+ if (el) syncScrollState(el);
+ };
+ window.addEventListener("resize", onResize);
+ return () => window.removeEventListener("resize", onResize);
+ }, [syncScrollState]);
+
const chatDisabled = trainingInProgress;
const usesDesktopTitlebar = usesCustomTitlebar || usesNativeMacTitlebar;
@@ -2399,9 +2413,10 @@ export function AppSidebar() {
<SidebarFooter
className={cn(
"relative pb-[11px] group-data-[collapsible=icon]:px-0",
- // Tighter top with the update card so the fade hugs it; fuller top
- // for the profile on its own.
- showUpdateCard ? "pt-1.5" : "pt-2.5",
+ // pt-[3px] cancels the profile button's -3px margin, so the 8px
+ // above it is whatever sits over the footer edge (the fade plateau,
+ // or the list's pb-2 once the fade is hidden) and 8px sits below.
+ showUpdateCard ? "pt-1" : "pt-[3px]",
)}
>
{/* Fade above the profile box, shown only when there's more list below
@@ -2412,11 +2427,12 @@ export function AppSidebar() {
className={cn(
// The scroll area hard-clips at the fade's bottom edge, so a plain
// ramp is still part-transparent there and slices the last row
- // mid-glyph. from-[16px] holds it opaque across the clip.
- "pointer-events-none absolute left-0 right-2 bottom-full bg-gradient-to-t from-[var(--sidebar-surface)] from-[16px] to-[rgb(from_var(--sidebar-surface)_r_g_b/0)] transition-opacity duration-200",
+ // mid-glyph. from-[8px] holds it opaque just across the clip, and
+ // matches the list's pb-2 so the gap is the same once it hides.
+ "pointer-events-none absolute left-0 right-2 bottom-full bg-gradient-to-t from-[var(--sidebar-surface)] from-[8px] to-[rgb(from_var(--sidebar-surface)_r_g_b/0)] transition-opacity duration-200",
// Shorter fade with the update card so the list reads closer to
// it, but still tall enough to clear a row.
- showUpdateCard ? "h-9" : "h-14",
+ showUpdateCard ? "h-7" : "h-10",
canScrollDown ? "opacity-100" : "opacity-0",
)}
/>