Skip to content

remove the unused images train dialog and fix media page responsiveness - #8215

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
mahiatlinux:fix/studio-media-responsiveness
Aug 9, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
mahiatlinux:fix/studio-media-responsiveness

Conversation

@mahiatlinux

Copy link
Copy Markdown
Contributor

Remove the unused Images train dialog

studio/frontend/src/features/images/diffusion-train-dialog.tsx has been dead since #6822, which replaced it with train/diffusion-train-panel.tsx in a single hunk:

-import { DiffusionTrainDialog } from "./diffusion-train-dialog";
+import { DiffusionTrainPanel } from "./train/diffusion-train-panel";

Nothing has referenced it since. DiffusionTrainDialog is its only export, the feature barrel exports ImagesPage alone, and no dynamic import, lazy route, registry entry or test names it. It carried a second copy of the dataset accept list, and #8016 spent responsiveness edits on it while it was already unreachable.

Caption tiles collapse once a dataset holds more than a few images

DatasetLabelingGrid renders grid max-h-[420px] grid-cols-2 overflow-y-auto with the default grid-auto-rows: auto. Once the tiles exceed the 420px cap the container height becomes definite, so Chrome divides it across the twelve auto rows instead of letting the grid scroll. Each tile is overflow-hidden, which gives it an automatic minimum size of zero, so its aspect-square thumbnail shrinks to nothing and the caption box below is clipped mid-line.

Measured in Chromium at 24 images: tile 26px, thumbnail 170x0, scrollHeight equal to clientHeight. With auto-rows-min the rows take their content height: tile 404px, thumbnail 170x170, scrollHeight 3552 against a 420px viewport, so the grid scrolls as intended. The fix holds for a caption long enough to wrap nine lines.

The Create | Train switch painted over the model selector

The Images header laid out three items with justify-between and then positioned the mode switch absolutely on top with absolute inset-x-0 flex justify-center, so the pill overlapped whatever the side controls needed. At a 390px header the model selector lost 124px to it and the Video link 44px, leaving "Sel" and a Video button painted under the pill.

The header is now grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]. Equal side tracks keep the pill centred on the page, and each side truncates inside its own column instead of colliding. Measured header widths 320 through 1280: no overlap anywhere and no horizontal page overflow.

The pill's px-11 padding also keyed off sm:, a viewport query, while the header's width is the viewport minus the sidebar, which is user-resizable between 260px and 480px. At a 900px window with a wide sidebar the header can be 420px while sm: still applies the 277px pill. Its padding now keys off the header's own width with @container, so the pair is 149px below a 560px header and 277px above.

Stat cells and charts broke on the viewport, not on their pane

The train run pane is whatever is left beside the 416px form column, but its stat grids used sm:grid-cols-4 and DiffusionCharts used lg:grid-cols-2. At a 768px viewport that put four stat cells into a ~266px pane. The widest cell needs 90px, so four plus gaps need 396px, and every label clipped.

The pane is now an @container and both break on its width: @min-[440px] for the stats, @min-[720px] for the charts. The nested @container in trainingSettings still resolves against itself. Measured at viewports 390 through 1600: two stat columns at a 442px pane, four at 566px, zero clipped cells at any width, charts splitting at 822px.

Video header pushed the Images link off screen

The Video header's left group held the model selector and the status chips with no min-w-0, so a long resident model name could not shrink. At a 390px viewport with Wan2.2-TI2V-5B-Diffusers-GGUF-Q8_0 loaded, the Images link sat at x=441 against a 390px viewport and the page gained 51px of horizontal overflow. The left group takes min-w-0 and the right takes shrink-0, which puts the link back on screen with the model name truncating.

Test contract

tests/studio/test_desktop_reliability_frontend_contract.py partitioned on the literal h-[48px] shrink-0 items-start justify-between, and matched interactive groups with flex items-center gap-. Both are order coupled, and the Images header is a grid now with min-w-0 between those tokens, so the test failed on both pages.

The marker is now the band size alone and the group pattern allows utilities between the tokens. Every assertion it made is intact, and it was mutation tested against four violations it must catch: dropping z-40 from the band, dropping pointer-events-auto from a group, resizing the band, and collapsing to one interactive group. All four still fail the test.

Verification

Manually verified in the running web UI. Layout numbers above were measured in headless Chromium against the shipped class strings.

Typecheck, 1310/1310 frontend tests, production build, i18n parity and the media header contract test all pass. No Python source changed. No GPU work is involved, so no training or CUDA checks were run.

diffusion-train-dialog.tsx has been dead since unslothai#6822 replaced it with
train/diffusion-train-panel.tsx. Nothing imports it, DiffusionTrainDialog is its
only export, and unslothai#8016 spent responsiveness edits on it while it was already
unreachable.

DatasetLabelingGrid capped its height at 420px with default auto rows, so once
the tiles passed the cap Chrome divided the definite height between them instead
of scrolling. Each tile is overflow-hidden, so its automatic minimum size is
zero and the aspect-square thumbnail collapsed: measured tile 26px, thumbnail
170x0. auto-rows-min restores tile 404px, thumbnail 170x170 and a scrolling grid.

The Images header positioned the Create | Train switch absolutely over a
justify-between row, so at a 390px header it painted 124px over the model
selector and 44px over the Video link. It is now a three column grid with equal
side tracks, and the pill padding keys off the header width rather than the
viewport, since the header is the viewport minus a resizable sidebar.

The train run pane sized its stat grids and charts on viewport breakpoints while
its own width is whatever is left beside the 416px form column, which put four
stat cells needing 396px into a 266px pane. The pane is a container now and both
break on its width.

The Video header's left group had no min-w-0, so a long resident model name
pushed the Images link 51px off a 390px viewport.

test_desktop_reliability_frontend_contract.py matched the header band on an
order coupled class literal. The marker is the band size now and the group
pattern allows utilities between the tokens; every assertion is intact and was
mutation tested against four violations it must catch.
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 996b216dec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

md: is a viewport query, but the header is the viewport minus a sidebar that is
resizable to 480px. At a 420px header the chips kept their intrinsic width and
squeezed the model name to zero. They now key off the header's own width, so the
name stays 230px readable below 720px and the chips return above it.
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1678f673c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The link button was shrink-0, so below a roughly 370px header its equal side
track underflowed the 90px control and the link overflowed left across the Train
tab. It now shrinks and truncates its label the way the model selector already
does, keeping the icon, the arrow and the tooltip. Measured at header widths 300
through 1000: link-left minus pill-right is -8 everywhere, previously +25 at 300.
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

1 similar comment
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 83d2910ffb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member

Reviewed this and pushed one fix in f2d39d0. Everything else checks out.

What I verified

  • diffusion-train-dialog.tsx really is dead. grep -rn "diffusion-train-dialog\|DiffusionTrainDialog" over the whole tree returns nothing after the delete, and the feature barrel exports ImagesPage alone.
  • Typecheck, 1310/1310 frontend tests, i18n:check:strict, production build and tests/studio/test_desktop_reliability_frontend_contract.py (29 passed) all green. Biome still exits 1, but that is the pre-existing drift the workflow already marks non blocking, and the file's diagnostic count is identical before and after my change.
  • The loosened contract test is not weaker in practice. I ran it against the pre-PR origin/main page sources (passes, so the loosening is backwards compatible) and against nine mutations: dropped z-40, dropped relative, dropped pointer-events-none, dropped pointer-events-auto, a resized band and a collapsed single group, on both pages. All nine still fail the test. The only thing no longer pinned is items-start justify-between, which the Images header cannot carry now anyway.
  • Measured the layout claims in headless Chromium against the production stylesheet rather than the class strings:
    • Labeling grid: the flattening needs a definite height ancestor, which the 416px settings rail is. With one, before gives tile 26px and thumbnail 176x0 with scrollHeight == clientHeight; after gives tile 325px and a scrolling grid. The max-h-[420px] on its own is not enough to trigger it, so the description is one step short of the mechanism, but the fix is right.
    • Images header: pill over selector 234px at a 300px header, 189px at 390px, 174px at a 420px header inside a 900px viewport, and the Video link 55px past the header at 300px. All zero after.
    • Video header: the interesting case is the wide sidebar one. At a 900px viewport with a 420px header the Images link sat 126px past the header's right edge before, 0 after. Confirms the md: to @min-[720px] swap was the load bearing part.
    • Train pane: four stat cells in a 266px pane clipped five labels before, two columns and zero clipping after, charts splitting at an 822px pane.
  • No containment fallout from the three new @container elements. None of the three regions has an absolute, fixed or z-* descendant written inline, PillTabs skips its absolute pill under fit, and both the tooltip and the model selector popover portal to body. The nested @container at diffusion-train-panel.tsx:955 still owns the @min-[324px] and @min-[498px] grids, so nothing rebinds.

The fix

Grid tracks lay out in the content box, and the header keeps pl-[var(--studio-media-header-left-inset,1.5rem)] pr-2. So minmax(0,1fr) auto minmax(0,1fr) centres the pill on the content box, which is half the padding difference right of the page centre. Measured +8.0px at every header width from 300 to 1280, where the old absolute inset-x-0 overlay resolved against the padding box and measured exactly 0.0px. The comment above it still says centred on the page.

I did not move the padding onto the side groups, since the left group is pointer-events-auto and that would turn 24px of drag region into a dead strip. A margin on the pill instead widens its auto track by the difference and, with justify-self-center centring the margin box, shifts the border box back by half of it, so the side tracks stay symmetric about the true centre.

  vp   hdr    arm      pill w  sel w  link w  centre offset
 320   300    before      112     70      70          +8.0
 320   300    after       112     62      62           0.0
 390   390    before      112    115      91          +8.0
 390   390    after       112    107      91           0.0
 900   420    before      112    130      91          +8.0
 900   420    after       112    122      91           0.0
1280  1280    before      240    240      91          +8.0
1280  1280    after       240    240      91           0.0

No overlap and no overflow at any width after the change, and the pill's own width is untouched. Typecheck, the full frontend suite, the contract test and the build all still pass.

@danielhanchen

Copy link
Copy Markdown
Member

One more thing, and it is not from my commit: this branch now conflicts with main, and the conflict is a design overlap rather than a mechanical one.

Studio: align Images and settings layouts (#8164) landed on main after this branch was cut and rewrote the same header. Main already has the three column grid, md:grid md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)], keeping the absolute overlay below md:. It also moved the left inset onto a pointer-events-none wrapper with the interactive group nested inside, which keeps that strip draggable, and it keys the pill padding off the viewport with md:[&>button]:px-3 xl:[&>button]:px-11. Studio: let image generation be stopped (#8219) then touched the same file again.

Both conflicted hunks are between that work and this branch:

  • studio/frontend/src/features/images/images-page.tsx, the header block.
  • tests/studio/test_desktop_reliability_frontend_contract.py, where main changed the same regex to r'"([^"]*pointer-events-auto flex[^"]*items-center gap-[^"]*)"'. Taking main's line as is would break this branch: it needs items-center gap- adjacent, and the Images right group here is pointer-events-auto flex min-w-0 items-center justify-end gap-2, so only one group would match and the len(groups) >= 2 assert would fail. The resolution wants main's pointer-events-auto inside the match plus this branch's non adjacent tokens, something like r'"([^"]*pointer-events-auto[^"]*\bflex\b[^"]*\bitems-center\b[^"]*\bgap-[^"]*)"'.

Worth rebasing on main and deciding which layout wins before this goes further. The part of this branch that main does not have is the container query, and that is the part that actually matters: md: and xl: are viewport queries while the header is the viewport minus a sidebar the user can drag to 480px, which is the case I measured at a 900px viewport with a 420px header. Main's md: gating means the header is still the absolute overlay below 768px, so the overlap I measured at 300 to 645px is still there on main today.

One thing to check while rebasing: main's container carries pr-2 with the left inset on the inner wrapper, so its grid tracks centre on a content box that is short 8px on the right only. That looks like the same offset I fixed here, about 4px the other way. I have not measured main's build, so treat that as a thing to confirm rather than a finding.

The train pane, labeling grid, video header and dead dialog parts of this branch merged clean and are unaffected.

# Conflicts:
#	studio/frontend/src/features/images/images-page.tsx
#	tests/studio/test_desktop_reliability_frontend_contract.py
@danielhanchen

Copy link
Copy Markdown
Member

Merged main into this branch in 3a6ada2 and resolved the two conflicts. Both were with Studio: align Images and settings layouts (#8164), which landed after this branch was cut and rewrote the same header, so this was a design merge rather than a mechanical one.

How I resolved it

I kept main's DOM and dropped its breakpoint gating.

Kept from main:

  • The pointer-events-none wrapper carrying the left inset with the interactive group nested inside. That is the right shape: padding on a pointer-events-auto group would turn the inset into a strip that neither clicks nor drags. I mirrored it on the right for pr-2.
  • isMobile / !pinned && isTauri inset selection, max-w-full overflow-hidden on the selector, and the pointer-events-auto flex min-w-0 max-w-full items-center gap-2 group.

Taken from this branch:

  • The grid runs at every width instead of md: and up, and the pill's padding keys off @min-[560px] instead of md: / xl:. Both were viewport queries, and the header is the viewport minus a sidebar the user can drag between 260px and 480px, so the two disagree exactly where it matters.

New in the resolution: the grid itself carries no horizontal padding at all. The insets moved onto the side tracks, so the equal minmax(0,1fr) tracks centre the pill on the header rather than on a content box that is short on one side. That also supersedes f2d39d0, which compensated for the old asymmetry with a margin; the margin is gone.

Measured

Same headless Chromium harness, production stylesheet, long resident model name. pill/sel is how far the pill paints over the model selector, pill/link over the Video link, centre off is the pill's centre against the header's.

  vp   hdr  arm     pill w  sel w  pill/sel  pill/link  centre off
 320  300   main       240    177       171         69         0.0
 320  300   merged     112     62         0          0         0.0
 390  390   main       240    240       189         24         0.0
 390  390   merged     112    107         0          0         0.0
 560  560   main       240    240       104          0         0.0
 560  560   merged     240    128         0          0         0.0
 645  645   main       240    240        61          0         0.0
 645  645   merged     240    171         0          0         0.0
 900  420   main       240    240       174          9         0.0
 900  420   merged     112    122         0          0         0.0
 900  900   main       240    240         0          0         0.0
 900  900   merged     240    240         0          0         0.0
1280 1280   merged     240    240         0          0         0.0

The 900 / 420 row is the sidebar case: a 900px window with the sidebar dragged wide, so md: applies while the header is only 420px. Zero overlap and zero horizontal overflow at every width from 300 to 1280 after the merge.

Test changes

  • test_media_page_headers_out_stack_the_mac_drag_region: took main's group regex verbatim. The resolved markup keeps pointer-events-auto flex and items-center gap- adjacent in both interactive groups, so main's stricter pattern matches and this branch's looser one is not needed. The band marker stays h-[48px] shrink-0, since the Images header is a grid and carries no justify-between.
  • test_images_header_clears_collapsed_tauri_titlebar_controls: this pinned the md: design by literal class string, so it had to move with the markup. Every assertion it made has an equivalent: the marker, grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] without the md: prefix, isMobile / pl-12 / !pinned && isTauri and both inset variables, the two left-control class strings, and the selector's max-w-full overflow-hidden. The mode-switch block now asserts justify-self-center and no absolute instead of md:static, and [&>button]:px-3 @min-[560px]:[&>button]:px-11 instead of md:[&>button]:px-3 xl:[&>button]:px-11. I also added an assertion that the grid opening carries no pl-/pr-/px-, which is what keeps the pill centred.

Typecheck, 1434/1434 frontend tests, i18n:check:strict, production build and the full tests/studio/test_desktop_reliability_frontend_contract.py (31 passed) are all green on the merge.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Aug 9, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 3a6ada21eb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit cf28871 into unslothai:main Aug 9, 2026
34 of 40 checks passed
@mahiatlinux
mahiatlinux deleted the fix/studio-media-responsiveness branch August 13, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants