Skip to content

Commit b605650

Browse files
author
Timofey Dergachev
committed
Fix attach static sheet
1 parent 894312f commit b605650

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

addon/stylesheet.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ export default class StyleSheet {
1818
this.options = options || {};
1919
}
2020

21-
createStaticSheetAndAttach(name) {
21+
createStaticSheet(name) {
22+
if (this.staticSheet) {
23+
return;
24+
}
25+
2226
const options = copy(this.options);
2327

2428
if (!options.meta) {
@@ -29,11 +33,11 @@ export default class StyleSheet {
2933
this.styles,
3034
options
3135
);
36+
}
3237

33-
if (!isEmpty(this.staticSheet.classes)) {
34-
this.staticSheet.attach();
35-
this.refs++;
36-
}
38+
attachStaticSheet() {
39+
this.staticSheet.attach();
40+
this.refs++;
3741
}
3842

3943
createDynamicSheetAndAttach(id, name) {
@@ -84,8 +88,10 @@ export default class StyleSheet {
8488
}
8589

8690
attach(id, name) {
87-
if (!this.staticSheet) {
88-
this.createStaticSheetAndAttach(name);
91+
this.createStaticSheet(name);
92+
93+
if (!isEmpty(this.staticSheet.classes)) {
94+
this.attachStaticSheet();
8995
}
9096

9197
this.createDynamicSheetAndAttach(id, name);

0 commit comments

Comments
 (0)