Skip to content

Commit

Permalink
fix: make sure subThemes are taken into account when generating style…
Browse files Browse the repository at this point in the history
… cache (#534)

* fix: make sure subThemes are taken into account when generating style cache

* fix: make sure style chain gets updated on subThemes

* fix: cleanup comments and test file

* fix: cleanup comments and test file

* fix: revert theme manager changes
  • Loading branch information
joshhowenstine authored Sep 27, 2024
1 parent 59873c1 commit fbcad55
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@lightningjs/ui-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@
"publishConfig": {
"access": "public"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ export default class StyleManager extends lng.EventEmitter {
this.update();
}

/**
* Clears the style chain cache.
*/
clearStyleChainCache() {
clearStyleChainCache();
}

/**
* Clears the source cache.
*/
Expand Down Expand Up @@ -127,6 +134,7 @@ export default class StyleManager extends lng.EventEmitter {
_generateCacheKey(name) {
const cacheKey = [
name,
this.component._targetSubTheme,
this.component.constructor.__componentName,
this._customStyleHash
]
Expand Down Expand Up @@ -204,7 +212,6 @@ export default class StyleManager extends lng.EventEmitter {
// Style source does not exist so it will need to be generated. We attempt to run this function only when necessary for optimal performance
styleSource = generateComponentStyleSource({
alias: this.component.constructor.aliasStyles,
componentConfig: this.component._componentConfig,
inlineStyle: this.component._componentLevelStyle,
styleChain: getStyleChainMemoized(this.component),
theme: this.component.theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export default function withThemeStyles(Base, mixinStyle = {}) {
if (this._targetSubTheme) {
this._styleManager.clearListeners();
this._styleManager.setupListeners();
this._styleManager.clearStyleChainCache();
this._styleManager.clearStyleCache();
this._styleManager.clearSourceCache();
this._styleManager.update();
Expand Down

0 comments on commit fbcad55

Please sign in to comment.