Skip to content

Commit

Permalink
Fixed nested themes not being republished on outer theme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Dec 21, 2017
1 parent 47ec911 commit 369ad6f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/emotion-theming/src/theme-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ThemeProvider extends Component {
if (this.context[channel] !== undefined) {
this.unsubscribeToOuterId = this.context[channel].subscribe(theme => {
this.outerTheme = theme
this.publish(this.props.theme)
})
}
this.broadcast = createBroadcast(this.getTheme(this.props.theme))
Expand All @@ -36,7 +37,7 @@ class ThemeProvider extends Component {

componentWillReceiveProps(nextProps) {
if (this.props.theme !== nextProps.theme) {
this.broadcast.publish(this.getTheme(nextProps.theme))
this.publish(nextProps.theme)
}
}

Expand Down Expand Up @@ -71,6 +72,10 @@ class ThemeProvider extends Component {
return { ...this.outerTheme, ...theme }
}

publish(theme) {
this.broadcast.publish(this.getTheme(theme))
}

render() {
if (!this.props.children) {
return null
Expand Down

0 comments on commit 369ad6f

Please sign in to comment.