From f96a56a44d75de38da7399b25803e0e83d5122b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 21 Dec 2017 01:30:10 +0100 Subject: [PATCH] Fixed nested themes not being republished on outer theme changes --- src/theme-provider.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/theme-provider.js b/src/theme-provider.js index 7ffa38d9..523d84b1 100644 --- a/src/theme-provider.js +++ b/src/theme-provider.js @@ -40,6 +40,11 @@ class ThemeProvider extends React.Component { setOuterTheme = theme => { this.outerTheme = theme + this.publishTheme() + } + + publishTheme(theme) { + this.broadcast.setState(this.getTheme(theme)) } componentDidMount() { @@ -53,13 +58,12 @@ class ThemeProvider extends React.Component { // set broadcast state by merging outer theme with own if (this.context[CHANNEL]) { this.setOuterTheme(this.context[CHANNEL].getState()) - this.broadcast.setState(this.getTheme()) } } componentWillReceiveProps(nextProps) { if (this.props.theme !== nextProps.theme) { - this.broadcast.setState(this.getTheme(nextProps.theme)) + this.publishTheme(nextProps.theme) } }