Repository navigation
fix: merge styled host scope class with a spread class - #961
Merged
Merged
Conversation
A synthesized scope hash is no longer a later writer that replaces props.class. Host-prop source resolution composes it onto the winning class identity on both client and SSR. Co-authored-by: Jon Wheeler <[email protected]>
Keep the merge flag off the last-writer record path so TypeScript can see pending class merges, and widen sibling source collectors to accept the optional fourth tuple member. Co-authored-by: Jon Wheeler <[email protected]>
jonkwheeler
marked this pull request as ready for review
September 4, 2026 19:17
leonidaz
added a commit
that referenced
this pull request
Sep 5, 2026
Resolve against main's #957, #960, and #961, which landed on the statement-scoped style machinery this branch replaces: - runtime.ts: keep the branch's `injectStyle` (main's in-place refresh is already here; the React Float match stays a `data-href` token match for batched multi-hash islands). - style-hmr-reinject.test.ts: take main's superset (adds the document-less case). - compile.js / style-scopes.js: keep the sibling-scope pre-pass; drop main's `componentStyleRoots`/`annotateRootWithHash`/`applyCssScoping` and the `applyStyleRefs` import. Main's synthesized-class merge flag (#961) applies unchanged to the pre-pass's stamped attributes. - `<style ref>` (#960) is not carried over: the attribute stays unsupported in Octane pending its removal from TSRX, so its fixture, tests, and changeset are dropped and the immutability fixture no longer uses it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 task done
14 of 21 tasks
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.
Fixes #941.
Summary
classwas appending a synthesized scope hash after the spread. Last-writer-wins then replacedprops.class, so the spread class never reached the DOM. Client and SSR agreed on the wrong value.classbeside a spread is unchanged: its hash is still baked into that authored value and stays last-writer-wins.Why
main.Changes
class/classNamesource with a trailing merge flag.setHostPropSourcesandssrAttrsapply that flag after identity last-writer-wins, composing viamergeClass.Validation
pnpm format:check(CI lint on7350af1f9)pnpm typecheck(CI typecheck on7350af1f9)pnpm test(CItest (24)plus shards on7350af1f9)style.test.ts(dev + prod); 264/264 acrossstyle.test.ts,clsx-class.test.ts,tsrx-features.test.ts,css-module-constants.test.ts(dev + prod projects)Head
7350af1f9is current withmain(28907dbd8). Required and relevant checks are green. No review threads.Risk / follow-ups
class+ spread last-writer-wins is intentionally unchanged, including the case where a later spread drops the baked-in hash.Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.