Skip to content

Styled host without an authored class loses the class from a spread #941

Closed

Description

@leonidaz

For a host element inside a styled scope that has a spread but no authored class, the compiler appends the synthesized scope class after the spread, e.g. <div {...props}> becomes _$setHostPropSources(el, [[true, spread], [false, 'class', '<hash>']], …). With the later-writer rule the explicit class replaces the spread's class, so props.class never reaches the DOM (client and server agree, so hydration matches).

This is pre-existing: main (single component hash) and #939 (scope chain + applied themes) emit identical output for

export function App(props) @{
	<>
		<style>.a { color: red; }</style>
		<div {...props}>x</div>
	</>
}

A fix belongs with the host-prop source resolution rather than the stamping: a synthesized scope class source could be merged with (rather than replace) a spread's class, the way an authored class beside a spread is already handled. Flagged by Cursor Bugbot on #939.

Activity

  1. jonkwheeler commented on Sep 4, 2026

    @jonkwheeler
    Contributor

    Working on this in #961

    @leonidaz The synthesized scope class now merges with the spread class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions