Skip to content

Compiler silently drops <style ref={…}> (class-map ref supported by the tsrx JSX targets) #940

Closed

Description

@leonidaz

@tsrx/core's JSX targets (React, Preact, Solid, Vue) support <style ref={x}>…</style>: the block's class-map object ({ $class, card, … }) is handed to x (assignment, callback, or a current/value ref) through createStyleRefSetupStatements. Octane's compiler has never handled that attribute: the analyzer accepts ref on a <style> block, but the scope pass strips the block and the ref target is never written, on main and on #939 alike.

export function App() @{
	let classes;
	<>
		<div class="a">a</div>
		<style ref={classes}>.a { color: red; }</style>
	</>
}

compiles with no diagnostic and classes stays undefined.

Options: implement it in packages/octane/src/compiler/style-scopes.js (the scope's class map is already built there; createStyleClassMap / createStyleRefSetupStatements are exported by @tsrx/core) for statement-list scopes and returned templates, or report ref on a <style> block as unsupported until then. Either is better than the silent drop.

Activity

  1. jonkwheeler commented on Sep 4, 2026

    @jonkwheeler
    Contributor

    Working on this in #960

    @leonidaz style ref now writes the class map (no silent drop).

  2. added a commit that references this issue on Sep 5, 2026
    e841a49
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