You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
injectStyle drops a re-injection with an unchanged hash but changed CSS (HMR hazard) #938
injectStyle(id, css) on the client (packages/octane/src/runtime.ts, _injectedStyles Set plus the style[data-octane=id] DOM query) dedupes by id only. Re-evaluating a module under HMR with an unchanged scope hash but changed CSS therefore leaves the old sheet in place: injectStyle(id, css1); injectStyle(id, css2) keeps css1.
With lexically scoped <style> blocks (RFC tsrx-org/RFCs#1, branch feat/scoped-styles-apply) the hash is derived from the first block's position and content, so editing a later block of a multi-block scope keeps the hash and hits this exactly. Pinned as it.fails in packages/octane/tests/runtime/style-hmr-reinject.test.ts next to a passing test of the current first-wins behavior.
Proposed fix: when a <style data-octane=id> already exists and its textContent differs from css, replace the text instead of returning; keep the Set for the no-DOM path. Consider also including a content hash in the id at compile time (the RFC's optional runtime dedupe, plan D12/S8.6).
Fixed in #939: injectStyle now refreshes a sheet this runtime already owns when a call arrives with an unchanged id and different CSS (a server-emitted sheet seen for the first time is still adopted untouched). Pinned by packages/octane/tests/runtime/style-hmr-reinject.test.ts.
Activity
leonidaz commentedon Sep 3, 2026
Fixed in #939:
injectStylenow refreshes a sheet this runtime already owns when a call arrives with an unchanged id and different CSS (a server-emitted sheet seen for the first time is still adopted untouched). Pinned bypackages/octane/tests/runtime/style-hmr-reinject.test.ts.jonkwheeler commentedon Sep 4, 2026
Also covered for main in #957
@leonidaz injectStyle replaces CSS when HMR keeps the same hash (same contract as #939 on the scoped-styles branch).
feat(compiler): sibling-scoped style blocks, $class, and apply (tsrx …