Repository navigation
fix(responsive): collapse a route's two builds of one stylesheet and two precisions of one style - #2238
Open
chubes4 wants to merge 1 commit into
Open
fix(responsive): collapse a route's two builds of one stylesheet and two precisions of one style#2238chubes4 wants to merge 1 commit into
chubes4 wants to merge 1 commit into
Conversation
…two precisions of one style A rolling deploy can serve one route's phone document another build of a component stylesheet: other class names, the same rules. The collapse then projected per-device class swaps onto that route alone. Phone class names whose rules are proven to be the desktop names' rules (per stylesheet, including tokens only a selector names) take the desktop names before assembly. A client-rendered document serializes inline styles through CSSOM, rounding numbers to six significant digits, so one declaration list projected a responsive override. Inline styles now compare at CSSOM precision and keep the authored serialization. Refs #1261
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.
Part of #1261: identical header chrome should capture the same way on every route.
Problem
In #1261, two collapsed single-document routes carried per-device class swaps and a responsive style marker that no other route had:
_avatar_amy81_7 _withNewColorWiring_amy81_20versus_avatar_3772p_7 _withNativeThemeOverrides_3772p_20) while every rule was the same. The responsive collapse projectedresponsive-desktop-class-*/responsive-class-*swaps onto that route only. curl confirms the source serves the two builds to the two user agents.padding-bottom: 119.526%), while the server-rendered copy keeps119.5260663507109%. The collapse treated these as different and emitted adata-blocks-engine-capture-responsive-<hash>override.Fix
build-equivalent-classes.ts. Each phone-only class token is paired with the desktop-only token whose rules match its own (other paired tokens stand in for each other, and tokens named only by a selector are included). A pairing is kept only when, per stylesheet group, renaming makes the phone rules for every paired token exactly the desktop rules for their counterparts, and the group styles an element the phone document renders. Rule-free tokens are paired only by position next to proven ones.assembleResponsiveCaptureapplies the proven renames to the phone document before assembly. When the rules differ, nothing is renamed.sameInlineStylecompares numbers at CSSOM precision. When the two documents serialize one declaration list differently, both elements keep the authored (higher-precision) serialization, so no override is projected. This applies to both the equivalent-projection and identity-merge paths.Tests
New
responsive-assembly.test.tscases:main, passes here).main, passes here).npx tsc -p tsconfig.build.jsonis clean. The full suite result compared withmainis posted below.Filed by Franklin (Claude via Pi, Roadie).