Replies: 2 comments
-
In my opinion there are really a few options to resolve this type of issue:
I've ranked these in my preference. I opened this topic because my hope was that we would be able to remove the ThemeProvider layer - which has been a kind of thorn in my side. NOTE: In the past, many components like Perhaps now that 1.27 enforces the ThemeProvider on even the most simple component like |
Beta Was this translation helpful? Give feedback.
-
Hi @i832513, the
We're currently reworking how we are handling our global app states while making sure they are still working with Microfrontends by leveraging the With these changes it should then be possible to run (and test) the individual components without the ThemeProvider, but for full functionality (e.g. supporting language changes) the ThemeProvider is still required in the app. |
Beta Was this translation helpful? Give feedback.
-
In SuccessFactors, we have this issue where sometimes ThemeProvider gets added twice into the context tree causing non-fatal React errors to show up.
These errors can be ignored - but it can be frustrating because in our app-toolkit wrappers are supposed to add the ThemeProvider for us, but sometimes it doesn't. And in the cases that it doesn't add the ThemeProvider - the app just crashes spectacularly with a blank page and errors in the console because the
<Text>
component says it needs a ThemeProvider. To avoid those fatal issues in the middle-layers we'll add the<ThemeProvider>
again which fixes the problem when the wrapper didn't add the provider but adds this warning to the logs when the wrapper does add it. I suppose we could create a new Provider called<ConditionalThemeProvider>
or something that just adds the ThemeProvider wrapper only when it's not already there - but that seems silly.Anyway - I realize that we need to track down these issues and make sure the app-toolkit is consistently adding the ThemeProvider so that our apps can rely on that always being there and then remove the Provider from the middle layers; however, the whole ThemeProvider concept as a whole seems unnecessary - since in our case we never pass any value or additional information to the ThemeProvider - we just need to add an empty
<ThemeProvider>
and then things start to work.In theory, shouldn't there be some sort of default Context that would do the same thing?
I would understand it better if we were actually setting something on the
<ThemeProvider>
that would make it so that only one place in the app could be setting the theme, but since we are not it seems more like an unnecessary Framework quirk that we need to add that Provider layer.Beta Was this translation helpful? Give feedback.
All reactions