Like it says on the tin.
Note; this PR does not increment the aphrodite-jss version, though it includes a change that will break interoperability with jss 7.1.7
A change in jss 8.0.0 broke interoperability with aphrodite-jss 1.1.1, specifically in how selector names are generated. In JSS 7.1.7, the RegularRule class would only invoke generateClassName only if className had not already been set on the rule, and would always use the .className to set the selector;
if (options.className) this.className = options.className
else if (generateClassName) this.className = generateClassName(this, sheet)
this.selectorText = options.selector || `.${this.className}`
In jss 8.0.0 RegularRule was renamed to StyleRule, className was dropped from its logic, and the selector name is always generated by invoking generateClassName;
This caused a mismatch between the aphrodite-jss-generated class name returned by css, and the selector generated by jss. Explicitly setting the Rule's selector in aphrodite-jss before adding it to the jss StyleSheet is one way to work around this issue.
... I probably didn't need to go into this much detail for this PR, but... Hooray for old habits?
Like it says on the tin. Note; this PR does not increment the aphrodite-jss version, though it includes a change that will break interoperability with jss 7.1.7
A change in jss 8.0.0 broke interoperability with aphrodite-jss 1.1.1, specifically in how selector names are generated. In JSS 7.1.7, the
RegularRule
class would only invokegenerateClassName
only ifclassName
had not already been set on the rule, and would always use the.className
to set the selector;In jss 8.0.0
RegularRule
was renamed toStyleRule
,className
was dropped from its logic, and the selector name is always generated by invokinggenerateClassName
;This caused a mismatch between the aphrodite-jss-generated class name returned by
css
, and the selector generated by jss. Explicitly setting the Rule'sselector
in aphrodite-jss before adding it to the jssStyleSheet
is one way to work around this issue.... I probably didn't need to go into this much detail for this PR, but... Hooray for old habits?