Repository navigation
Read the sidebar pin's width only where matchMedia exists, and expect the update card's scaled width - #11700
Merged
Conversation
#11660 made use-sidebar-pin read the lg media query when it is imported, without asking whether window.matchMedia exists. Frontend tests that reach the window titlebar supply a partial window with no matchMedia, so the import threw and failed training-dataset-source-transitions.test.ts on main. With nothing to ask, keep the desktop default, as the module already does when there is no window at all, and skip the width listener.
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
shaojun
pushed a commit
to shaojun/unsloth
that referenced
this pull request
Sep 29, 2026
… the update card's scaled width (unslothai#11700) * Read the sidebar pin's width default only where matchMedia exists unslothai#11660 made use-sidebar-pin read the lg media query when it is imported, without asking whether window.matchMedia exists. Frontend tests that reach the window titlebar supply a partial window with no matchMedia, so the import threw and failed training-dataset-source-transitions.test.ts on main. With nothing to ask, keep the desktop default, as the module already does when there is no window at all, and skip the width listener. * Expect the update card's scaled width at a larger UI size unslothai#11648 made the card's max width calc(448px * var(--ui-space-scale, 1)), so at the 20px UI size it is 597px, and the layout pass still wanted 448. The pass only reached that check once unslothai#11673 made its scale probe readable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two checks are red on main (
ebf2f2a5d). Both show on #11603, the first PR whose CI ran against a main with today's fixes.1. Frontend unit tests:
training-dataset-source-transitions.test.ts(product)This fails both
Frontend build + bundle sanityandFrontend unit tests (Windows), and reproduces locally on main.Cause: #11660 made
use-sidebar-pin.tsread the(min-width: 1024px)query when the module is imported, viareadStored() ?? window.matchMedia(WIDE_QUERY).matches. It never asks whetherwindow.matchMediaexists. Frontend tests whose import graph reaches the window titlebar set a partialwindowwith nomatchMedia, so the import throws and the whole file fails.Why fix the product rather than the test: the module already handles
typeof window === "undefined"by keeping the desktop default. A read at import time that throws takes down every importer, not one call. It now asks throughwideQuery(), which returns null when there is nomatchMedia. The width default then falls back to pinned, the same as with no window, andsubscribeskips the width listener. Browsers behave exactly as before.New test:
tests/sidebar-pin-without-matchmedia.test.tshas two cases:matchMedia, the module imports, holds and releases.matchMedia, the lg query is still read, once on load and again on release.Against main's hook, both cases fail.
2. Chat UI Tests (chat): the update card's width at 20px (test)
Cause: #11648 made the card's max width
calc(448px * var(--ui-space-scale, 1)). At the 20px UI size that is 448 * 1.25 / 0.9375 = 597.3px, which is what the page measured. The layout pass still wanted a fixed 448. It only reached this check once #11673 made the pass's font-scale probe readable. Before that, the 20px pass could not tell it was scaled.Change:
playwright_update_banner_layout.pyreads--ui-space-scalethrough a length probe, the same way it now reads--ui-font-scale, and wantsmin(448 * scale, width - 32). At the default size the scale is 1, so the 448 check is unchanged.Verification
tsc -b,vite buildandbundle:checkall pass, with 208.9 KB raw to spare.npm testpasses: 8,599 tests, 0 failed.training-dataset-source-transitions.test.tspasses 9 of 9.Chat UI Tests (chat)is what verifies it.