Fix: Embed - Auto theme configured using embed config doesn't work when there is non-system theme configured in appearance. (#9030)

* Differentiate b/w auto theme and unspecified theme

* Fix TS
This commit is contained in:
Hariom Balhara authored and GitHub committed 2023-05-22 11:17:56 +00:00
1 parent ff6c6ccec0
commit 8a6b93a747
4 files changed
+13 -9

No files matched your search

+4 -2
View File
@@ -21,8 +21,10 @@ export default function useTheme(themeToSet?: Maybe<string>) {
return;
}
// Embed theme takes precedence over theme configured in app. If embedTheme isn't set that is it's in 'Auto' mode, then it would use the theme configured in appearance.
const finalThemeToSet = embedTheme || themeToSet;
// Embed theme takes precedence over theme configured in app.
// If embedTheme isn't set i.e. it's not explicitly configured with a theme, then it would use the theme configured in appearance.
// If embedTheme is set to "auto" then we consider it as null which then uses system theme.
const finalThemeToSet = embedTheme ? (embedTheme === "auto" ? null : embedTheme) : themeToSet;
if (!finalThemeToSet || finalThemeToSet === activeTheme) return;