Repository navigation
tw-sweep capture waits for fonts and two frames, as parity's openPage does - #171
Merged
Merged
Conversation
… and emitted CSS)
…y's openPage does, and refuses a page whose fonts are not loaded
Commands: pnpm regen
Commands: pnpm regen
Commands: pnpm regen
Commands: pnpm regen
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.
Follow-up to #161's Low finding.
What changed
packages/tailwind-sweep/src/chrome.ts,capture(): aftersetContent, the page loads Ahem, waits fordocument.fonts.ready, then waits two frames, as parity'sopenPagedoes.document.fonts.statusis notloaded, so a ch or ex utility can never be measured on a fallback font. That matters now that the sweep runs 8 cold contexts at once.Tests
chrome-pages.test.ts, new case: 16 ch/ex boxes against their px equivalents (Ahem: 1ch = 1em, 1ex = 0.8em at the 16px root), on 8 cold pages at once. No box may differ.setContentwaits for the load event. So this is a defensive guard; the test pins the behaviour, but it does not catch the race.What passed
pnpm typecheck: pass, including after merging origin/master.vitest run packages/tailwind-sweep/test/chrome-pages.test.ts packages/tailwind-sweep/test/units.test.ts: 37 passed.pnpm regenon the branch (job regen-speed-tw-fonts): only tw-sweep ran, in 221 s. Fixed point after 1 pass, 0 files changed,git statusclean. The snapshot is byte-identical.Note
The text stack adds a similar
checkFontsLoadedcheck in this function, so one of the two will take a small merge.No tolerance, check, test or fixture changed.
🤖 Generated with Claude Code