Skip to content

Commit 2186ef6

Browse files
committed
Improve performance for dynamic styles
1 parent e10cf09 commit 2186ef6

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/index.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,19 @@ const createStyled = (jss?: Function = jssDefault) => (baseStyles: Object = {})
6363
}
6464

6565
if (dynamicStyles && !dynamicSheet.getRule(this.tagScoped)) {
66-
dynamicSheet.addRule(this.tagScoped, dynamicStyles)
66+
dynamicSheet
67+
.detach()
68+
.addRule(this.tagScoped, dynamicStyles)
6769
dynamicSheet
6870
.update(this.tagScoped, this.props)
69-
.deploy()
71+
.attach()
72+
.link()
7073
}
7174
}
7275

7376
componentWillReceiveProps(nextProps: StyledElementPropsType) {
7477
if (dynamicStyles) {
75-
dynamicSheet
76-
.update(this.tagScoped, nextProps)
77-
.deploy()
78+
dynamicSheet.update(this.tagScoped, nextProps)
7879
}
7980
}
8081

0 commit comments

Comments
 (0)