cssinjs / theming

Unified CSSinJS theming solution for React
300 stars 39 forks source link

Theme callback called twice #26

Closed oliviertassinari closed 6 years ago

oliviertassinari commented 6 years ago

This issue is part of a series of feedbacks. I been upgrading the Material-UI solution. Unfortunately, I had to fork the package in order to reach my goal. Now, it's time to reconciliation.

The issue

I have noticed that a theme callback can be called twice during a first render. The first time, it's called with a null outer theme. I think that it can be reproduced with the following:

<ThemeProvider theme={x}>
  <ThemeProvider theme{(x) => { console.log(x) }>
    <div />
  </ThemeProvider>
</ThemeProvider>