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: stop hidden source badges from inflating chat scroll height (#5822)

Daniel Hanb66d35b425d3
diff --git a/studio/frontend/src/components/assistant-ui/sources.tsx b/studio/frontend/src/components/assistant-ui/sources.tsx
index 140b61f9322..5593369bf94 100644
--- a/studio/frontend/src/components/assistant-ui/sources.tsx
+++ b/studio/frontend/src/components/assistant-ui/sources.tsx
@@ -263,20 +263,34 @@ const SourcesGroup: FC = () => {
return (
<div className="relative mt-2 mb-3">
- {/* Hidden measurement container — renders all badges to measure row positions */}
+ {/* Hidden measurement container. Renders all badges off-screen so we
+ can read each child's offsetTop and decide how many fit in two
+ rows. Wrapped in an absolute, h-0, overflow-hidden box so the
+ measurement pills do NOT contribute to the viewport's scrollable
+ overflow region. Without this clip, every hidden source row
+ adds ~30px to scrollHeight, producing a phantom empty scroll
+ area below the message: visible to users as unbounded blank
+ space below the assistant action bar. The inner div still
+ flex-wraps its children for measurement; offsetTop reads
+ correctly because the wrapper is positioned (absolute) and the
+ children's offsetTop is measured relative to it. */}
<div
- ref={containerRef}
aria-hidden
- className="flex w-full flex-wrap gap-1 invisible absolute pointer-events-none"
+ className="absolute pointer-events-none overflow-hidden h-0 w-full left-0 top-0"
>
- {sources.map((source) => (
- <span key={source.id} className="inline-block">
- <Source href={source.url}>
- <SourceIcon url={source.url} />
- <SourceTitle>{source.title || extractDomain(source.url)}</SourceTitle>
- </Source>
- </span>
- ))}
+ <div
+ ref={containerRef}
+ className="flex w-full flex-wrap gap-1 invisible"
+ >
+ {sources.map((source) => (
+ <span key={source.id} className="inline-block">
+ <Source href={source.url}>
+ <SourceIcon url={source.url} />
+ <SourceTitle>{source.title || extractDomain(source.url)}</SourceTitle>
+ </Source>
+ </span>
+ ))}
+ </div>
</div>
{/* Visible container */}