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 the update banners floating off the corner (#10229)

oobabooga8e26d2c2bacf
diff --git a/studio/frontend/src/components/llama-update-banner.tsx b/studio/frontend/src/components/llama-update-banner.tsx
index 9bceb7e2c3d..eec80260e38 100644
--- a/studio/frontend/src/components/llama-update-banner.tsx
+++ b/studio/frontend/src/components/llama-update-banner.tsx
@@ -126,6 +126,14 @@ export function LlamaUpdateBanner({
const changelogAvailable = Boolean(changelogKey && !status?.source_build);
const changelogOpen =
changelogKey !== null && changelogVersion === changelogKey;
+ // Use the same predicate for the panel and its protective height floor.
+ const changelogPanelOpen = Boolean(
+ !applying &&
+ changelogAvailable &&
+ changelogOpen &&
+ installedTag &&
+ latestTag,
+ );
const sizeLabel =
sizeBytes && sizeBytes > 0
? `${Math.round(sizeBytes / (1024 * 1024))} MB`
@@ -145,12 +153,18 @@ export function LlamaUpdateBanner({
className={cn(
positioned
? "fixed bottom-4 right-4 z-[9998] w-[calc(100vw-2rem)] max-w-[448px]"
- : // The desktop updater's floor: in a capped stack only the notes give up height.
- "pointer-events-auto flex min-h-[calc(117px+93px*var(--ui-font-scale,1))] w-[calc(100vw-2rem)] max-w-[448px] flex-col max-[383px]:min-h-[calc(24px+224px*var(--ui-font-scale,1))]",
+ : cn(
+ "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] flex-col",
+ // Only an open changelog needs a shrinkable height floor.
+ changelogPanelOpen
+ ? "min-h-[calc(117px+93px*var(--ui-font-scale,1))] max-[383px]:min-h-[calc(24px+224px*var(--ui-font-scale,1))]"
+ : "shrink-0",
+ ),
)}
data-testid="llama-update-banner"
>
- <div className="relative flex max-h-[calc(100dvh_-_2rem)] min-h-0 flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
+ {/* Paint the full floor even when the changelog content is short. */}
+ <div className="relative flex max-h-[calc(100dvh_-_2rem)] min-h-0 grow flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
{applying ? null : (
<button
type="button"
@@ -201,14 +215,7 @@ export function LlamaUpdateBanner({
</div>
</div>
- {/* changelogAvailable, not just changelogOpen: if the install turns into
- a source build while the panel is open, the toggle unmounts and the
- panel would otherwise be left on screen with no way to close it. */}
- {!applying &&
- changelogAvailable &&
- changelogOpen &&
- installedTag &&
- latestTag ? (
+ {changelogPanelOpen && installedTag && latestTag ? (
<LlamaUpdateChangelogPanel
installedTag={installedTag}
latestTag={latestTag}
diff --git a/studio/frontend/src/components/tauri/update-banner.tsx b/studio/frontend/src/components/tauri/update-banner.tsx
index 4f88d6fb2ef..0e5493d73f3 100644
--- a/studio/frontend/src/components/tauri/update-banner.tsx
+++ b/studio/frontend/src/components/tauri/update-banner.tsx
@@ -213,34 +213,16 @@ export function UpdateBanner({
positioned
? "fixed bottom-4 right-4 z-[9999] w-[calc(100vw-2rem)] max-w-[448px]"
: cn(
- "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] flex-col",
- // Floor = the header and the action row, the parts of this
- // card that cannot give up height. Under it a capped rail
- // takes the height out of the notes, which clip;
- // min-height:auto would instead be the whole card, so this
- // one would yield nothing and clip the banner below it.
- //
- // Its own constants, not the browser card's: this card
- // carries one more status line under the version, worth about
- // 20px at the default type size and 24px at the largest.
- // Measured the same way, at every step from 15px to 20px:
- // 204, 210, 215, 221, 227, 233 at the widths where the action
- // pair holds together, and 204, 210, 262, 269, 277, 304 below
- // 384px where it wraps onto a row of its own. See
- // web/update-banner for why the floor is split into a fixed
- // and a scaled part, and why the narrow regime needs its own.
- //
- // The failure card has no notes to give up, so shrinking it
- // could only clip the diagnostics and the retry button. It
- // holds its height and the rail scrolls instead.
- showFailure
- ? "shrink-0"
- : "min-h-[calc(117px+93px*var(--ui-font-scale,1))] max-[383px]:min-h-[calc(24px+224px*var(--ui-font-scale,1))]",
+ "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] shrink-0 flex-col",
+ // Only rendered notes may shrink in the capped rail. Without
+ // them, shrink-0 keeps the compact card at its natural height.
+ "has-[[data-slot=update-release-notes]]:min-h-[calc(117px+93px*var(--ui-font-scale,1))] has-[[data-slot=update-release-notes]]:shrink max-[383px]:has-[[data-slot=update-release-notes]]:min-h-[calc(24px+224px*var(--ui-font-scale,1))]",
),
)}
data-testid="tauri-update-banner"
>
- <div className="relative flex max-h-[calc(100dvh_-_2rem)] min-h-0 flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
+ {/* Paint the full floor even when the notes content is short. */}
+ <div className="relative flex max-h-[calc(100dvh_-_2rem)] min-h-0 grow flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
<button
type="button"
onClick={onDismiss}
diff --git a/studio/frontend/src/components/update/release-notes-panel.tsx b/studio/frontend/src/components/update/release-notes-panel.tsx
index e29cc167834..71bc1b31a84 100644
--- a/studio/frontend/src/components/update/release-notes-panel.tsx
+++ b/studio/frontend/src/components/update/release-notes-panel.tsx
@@ -119,6 +119,8 @@ export function ReleaseNotesPanel({
// Clipped, not just capped: this is the one part of the card allowed to
// give up height, so its content must not paint over the buttons below.
className={UPDATE_NOTES_ROOT_CLASS}
+ // Lets the parent apply its floor only when this panel renders.
+ data-slot="update-release-notes"
data-testid="update-release-notes-panel"
data-notes-state={state}
data-notes-version={version}
diff --git a/studio/frontend/src/components/web/update-banner.tsx b/studio/frontend/src/components/web/update-banner.tsx
index 38f72f9a98e..f0b4cc8f8cb 100644
--- a/studio/frontend/src/components/web/update-banner.tsx
+++ b/studio/frontend/src/components/web/update-banner.tsx
@@ -85,32 +85,17 @@ export function WebUpdateBanner({
// Wider than the other overlays: notes preview plus three buttons.
positioned
? "fixed bottom-4 right-4 z-[9999] w-[calc(100vw-2rem)] max-w-[448px]"
- : // Floor = the header and the action row, the parts of this card
- // that cannot give up height. Under it a capped rail takes the
- // height out of the notes, which clip; min-height:auto would
- // instead be the whole card, so this one would yield nothing
- // and clip the banner below it.
- //
- // A fixed part plus a font-scaled part, the shape index.css
- // already uses for --picker-control-h, because only some of the
- // card moves with Settings > Appearance. Measured at every step
- // from 15px to 20px rather than guessed, and exact across that
- // range: 184, 189, 194, 199, 204, 209. Scaling the whole 12rem
- // box instead asked 256px where 209 was needed, and a floor
- // nothing can meet covers the composer for no gain.
- //
- // Below 384px the action pair wraps onto a row of its own on
- // top of the notes toggle's, and the card needs a whole extra
- // row: 259px at 20px where the wide card needs 209. A floor
- // that misses it lets a dodging placement clip a row of
- // buttons inside the card's own overflow-hidden surface. The
- // narrow constants bound that regime (229, 235, 241, 247, 253,
- // 259) and are exact from 17px up, where the extra wrap starts.
- "pointer-events-auto flex min-h-[calc(109px+80px*var(--ui-font-scale,1))] w-[calc(100vw-2rem)] max-w-[448px] flex-col max-[383px]:min-h-[calc(139px+96px*var(--ui-font-scale,1))]",
+ : cn(
+ "pointer-events-auto flex w-[calc(100vw-2rem)] max-w-[448px] shrink-0 flex-col",
+ // Only rendered notes may shrink in the capped rail. Without
+ // them, shrink-0 keeps the compact card at its natural height.
+ "has-[[data-slot=update-release-notes]]:min-h-[calc(109px+80px*var(--ui-font-scale,1))] has-[[data-slot=update-release-notes]]:shrink max-[383px]:has-[[data-slot=update-release-notes]]:min-h-[calc(139px+96px*var(--ui-font-scale,1))]",
+ ),
)}
data-testid="web-update-banner"
>
- <div className="relative flex max-h-[calc(100dvh_-_2rem)] min-h-0 flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
+ {/* Paint the full floor even when the notes content is short. */}
+ <div className="relative flex max-h-[calc(100dvh_-_2rem)] min-h-0 grow flex-col overflow-hidden rounded-[24px] bg-white px-5 pb-4 pt-5 shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)] dark:bg-card dark:shadow-[0_8px_28px_-6px_rgba(0,0,0,0.28)]">
<button
type="button"
onClick={dismiss}
diff --git a/studio/frontend/tests/update-banner-flex-priority.test.ts b/studio/frontend/tests/update-banner-flex-priority.test.ts
index feb726a7758..97ea09055dd 100644
--- a/studio/frontend/tests/update-banner-flex-priority.test.ts
+++ b/studio/frontend/tests/update-banner-flex-priority.test.ts
@@ -93,14 +93,40 @@ for (const [name, source] of CARDS) {
});
}
-test("the desktop failure card does not shrink at all", () => {
- // It has no notes panel, so there is nothing in it to give up: shrinking it
- // only clips the diagnostics and the retry button.
- assert.match(
- TAURI,
- /showFailure\s*\n?\s*\? "shrink-0"/,
- "the failure card shares the notes-bearing card's floor, which is too low",
- );
+test("a card with no notes panel does not shrink at all", () => {
+ // Only a rendered notes panel gives the card content it may shrink.
+ for (const [name, source] of CARDS) {
+ const stacked = classes(source, "pointer-events-auto flex ");
+ assert.match(stacked, /\bshrink-0\b/, `the ${name} card can be squeezed`);
+ assert.doesNotMatch(
+ source,
+ /["\s]min-h-\[calc\(/,
+ `the ${name} card floors unconditionally again, around a card that may paint none of it`,
+ );
+ assert.match(
+ source,
+ /has-\[\[data-slot=update-release-notes\]\]:min-h-\[calc\(/,
+ `the ${name} card's floor is not gated on its notes panel`,
+ );
+ assert.match(
+ source,
+ /has-\[\[data-slot=update-release-notes\]\]:shrink\b/,
+ `the ${name} card cannot give up its notes' height once it has them`,
+ );
+ }
+ // Keep the selector and its target coupled.
+ assert.match(NOTES, /data-slot="update-release-notes"/);
+});
+
+test("a floored card paints all the height its slot reserves", () => {
+ // Short notes content must not leave an unpainted gap inside the floor.
+ for (const [name, source] of [...CARDS, ["llama.cpp", LLAMA] as const]) {
+ assert.match(
+ classes(source, "relative flex max-h-[calc(100dvh_-_2rem)] "),
+ /\bgrow\b/,
+ `the ${name} card can be shorter than the slot it sits in`,
+ );
+ }
});
test("the desktop failure card can scroll to its own diagnostics", () => {
@@ -131,7 +157,7 @@ test("the two update cards do not drift apart", () => {
const root = (source: string) =>
classes(source, "pointer-events-auto flex ")
.split(" ")
- .filter((rule) => !/^(max-\[\d+px\]:)?min-h-/.test(rule))
+ .filter((rule) => !/(^|:)min-h-/.test(rule))
.join(" ");
assert.equal(
root(TAURI),
@@ -148,15 +174,35 @@ test("the two update cards do not drift apart", () => {
}
});
-test("the llama.cpp card shares the desktop updater's responsive floor", () => {
- const llamaRoot = classes(LLAMA, "pointer-events-auto flex ");
+test("the llama.cpp card takes the desktop updater's floor only with its changelog open", () => {
+ // A collapsed changelog leaves nothing for the floor to protect.
+ const slot = LLAMA.slice(
+ LLAMA.indexOf("pointer-events-auto flex "),
+ LLAMA.indexOf('data-testid="llama-update-banner"'),
+ );
+ // The constants match the desktop card, though their gates differ.
for (const floor of [
"min-h-[calc(117px+93px*var(--ui-font-scale,1))]",
- "max-[383px]:min-h-[calc(24px+224px*var(--ui-font-scale,1))]",
+ "min-h-[calc(24px+224px*var(--ui-font-scale,1))]",
]) {
- assert.ok(llamaRoot.includes(floor) && TAURI.includes(floor));
+ assert.ok(slot.includes(floor) && TAURI.includes(floor));
}
- assert.doesNotMatch(llamaRoot, /\bshrink-0\b/);
+ assert.match(slot, /max-\[383px\]:min-h-\[calc\(24px/);
+ assert.match(
+ slot,
+ /changelogPanelOpen\s*\n?\s*\?\s*"min-h-\[calc\(117px/,
+ "the floor is back on every state of the card, including the collapsed one",
+ );
+ // The floor and panel share the same predicate.
+ assert.match(LLAMA, /\{changelogPanelOpen &&/);
+ assert.match(
+ slot,
+ /"shrink-0"/,
+ "with no notes to give up, the card must hold its height and let the rail scroll",
+ );
+ // Only the conditional branch may carry a floor.
+ assert.doesNotMatch(classes(LLAMA, "pointer-events-auto flex "), /min-h-/);
+ assert.doesNotMatch(slot, /\bmin-h-0\b/);
assert.ok(LLAMA.includes("max-w-[448px]"));
});
diff --git a/tests/studio/playwright_update_banner_layout.py b/tests/studio/playwright_update_banner_layout.py
index b06ff23cecf..54df33fdac1 100644
--- a/tests/studio/playwright_update_banner_layout.py
+++ b/tests/studio/playwright_update_banner_layout.py
@@ -107,6 +107,8 @@ RELEASE_NOTES = {
"release_notes_url": "https://unsloth.ai/docs/new/changelog",
"error": None,
}
+# A successful lookup with no previewable body.
+RELEASE_NOTES_NONE = dict(RELEASE_NOTES, markdown = "", matched = False)
LLAMA_STATUS = {
"supported": True,
"update_available": True,
@@ -273,6 +275,9 @@ NOTHING_STT = {
# corner. Two is enough, since what is being checked does not vary with size.
INDICATOR_VIEWPORTS = [(921, 534), (768, 500)]
+# One roomy viewport and one capped viewport.
+NO_PREVIEW_VIEWPORTS = [(1440, 900), (921, 534)]
+
# Where the rail actually is, against the corner it is anchored to. It was
# placed from JS for a while, lifting clear of the boxes in the frame store,
# and drifted to the middle and the top of the window as those boxes and its
@@ -447,6 +452,16 @@ MEASURE = """
if (bottom <= top || right <= left) return null;
return {top, bottom, left, right, width: right - left, height: bottom - top};
};
+ // Measure any height the slot reserves but its surface does not paint.
+ const dead = (el) => {
+ if (!el || !el.firstElementChild) return null;
+ const a = el.getBoundingClientRect();
+ const b = el.firstElementChild.getBoundingClientRect();
+ const round = (n) => Math.round(n * 10) / 10;
+ return {above: round(b.top - a.top), below: round(a.bottom - b.bottom),
+ slot: round(a.height), painted: round(b.height),
+ minHeight: getComputedStyle(el).minHeight};
+ };
const q = (sel) => document.querySelector(sel);
const card = q('[data-testid="web-update-banner"]');
const llama = q('[data-testid="llama-update-banner"]');
@@ -466,6 +481,7 @@ MEASURE = """
// Clipped by the card, not by the rail. What the rail hides is under a
// fold the reader can scroll to; what the card hides is gone for good.
card: rect(card), llama: rect(llama),
+ cardDead: dead(card), llamaDead: dead(llama),
// The same two, as much of them as the rail is SHOWING. Containment is
// asked of these: a card the rail has folded away is not on screen at all,
// and judging its unclipped rect against the viewport fails it for being
@@ -669,6 +685,16 @@ def measure(page, label: str) -> dict:
facts["gutterIsRail"] is False,
f"scrolls={scrolls} gutterIsRail={facts['gutterIsRail']}",
)
+ # A floor must not leave unpainted space around a compact card.
+ for name in ("card", "llama"):
+ hole = facts[f"{name}Dead"]
+ if hole is None:
+ continue
+ check(
+ f"{label}: the {name}'s slot reserves no height it does not paint",
+ hole["above"] <= 1.0 and hole["below"] <= 1.0,
+ f"{name}Dead={hole}",
+ )
# The notes are allowed to yield all of their height, and do; the controls
# are not, and a card clipped to nothing is the failure being tested for.
for name in ("card", "llama", "toggle", "snooze", "copy"):
@@ -959,6 +985,39 @@ def main() -> int:
llama_payload[0] = LLAMA_STATUS
context.close()
+ # Exercise the compact app card omitted by the notes-bearing fixtures.
+ for width, height in NO_PREVIEW_VIEWPORTS[:1] if SPOT else NO_PREVIEW_VIEWPORTS:
+ context = browser.new_context(
+ viewport = {"width": width, "height": height},
+ reduced_motion = "reduce",
+ )
+ context.add_init_script(seed_js)
+ for pattern, payload in (
+ ("**/api/studio/update-status*", UPDATE_STATUS),
+ ("**/api/studio/release-notes*", RELEASE_NOTES_NONE),
+ ("**/api/llama/update-status*", LLAMA_STATUS),
+ ("**/api/llama/update-changelog*", LLAMA_CHANGELOG),
+ ):
+ context.route(pattern, stub(payload))
+ page = context.new_page()
+ boot(page, "/")
+ panel = page.locator('[data-testid="update-release-notes-panel"]')
+ check(
+ f"{width}x{height} with no preview: the collapsed card shows no notes",
+ panel.count() == 0,
+ "the card is at its full height, so this pass proves nothing",
+ )
+ measure(page, f"{width}x{height} with no preview")
+ page.screenshot(path = str(ART / f"{width}x{height}-no-preview.png"))
+ # Expanded, the panel is back and so is the floor it pays for.
+ toggle = page.locator('[data-testid="web-update-release-notes-toggle"]')
+ if toggle.count() == 1:
+ toggle.click()
+ panel.wait_for(state = "visible", timeout = 10_000)
+ page.wait_for_timeout(SETTLED_MS)
+ measure(page, f"{width}x{height} with no preview, expanded")
+ context.close()
+
# The loaded models indicator, switched on. It is the last child of the
# rail, so it lands on the corner, and its arrival used to re-measure
# the rail and move the whole stack. That is the case to check.