File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/components/ThemeProvider Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class ThemeProvider extends Component {
10
10
constructor ( props ) {
11
11
super ( props ) ;
12
12
const theme = this . getMergedTheme ( props . theme ) ;
13
+ this . cache = JSON . stringify ( theme ) ;
13
14
this . state = {
14
15
theme
15
16
} ;
@@ -19,13 +20,13 @@ class ThemeProvider extends Component {
19
20
theme : PropTypes . object . isRequired
20
21
} ;
21
22
getMergedTheme = theme => {
22
- this . cache = JSON . stringify ( theme ) ;
23
23
return generateTheme ( theme ) ;
24
24
} ;
25
25
componentWillReceiveProps ( nextProps ) {
26
26
const { theme } = nextProps ;
27
- const mergedTheme = this . getMergedTheme ( theme ) ;
28
27
if ( JSON . stringify ( theme ) !== this . cache ) {
28
+ const mergedTheme = this . getMergedTheme ( theme ) ;
29
+ this . cache = JSON . stringify ( theme ) ;
29
30
this . setState ( {
30
31
theme : mergedTheme
31
32
} ) ;
You can’t perform that action at this time.
0 commit comments