Hotfix: Fix theme not changing once page has started loading (#8400)

* Fix theme not changing once page is loaded

* Add toggle case in playground
This commit is contained in:
Hariom Balhara
2023-04-20 11:57:28 +00:00
committed by GitHub
parent f9d9e74d6b
commit c38dd2d072
2 changed files with 3 additions and 3 deletions
+2
View File
@@ -161,6 +161,8 @@
<h3>
<a href="?only=ns:default">[Dark Theme][Guests(janedoe@example.com and test@example.com)]</a>
</h3>
<button onclick="Cal('ui',{theme:'light'})" >Toggle to Light</button>
<i class="last-action"> You would see last Booking page action in my place </i>
<div>
<div class="place" style="width: 100%"></div>
+1 -3
View File
@@ -22,10 +22,8 @@ export default function useTheme(themeToSet?: Maybe<string>) {
if (!finalThemeToSet || finalThemeToSet === activeTheme) return;
console.log("Setting theme", { resolvedTheme, finalThemeToSet, activeTheme, forcedTheme });
setTheme(finalThemeToSet);
// eslint-disable-next-line react-hooks/exhaustive-deps -- we do not want activeTheme to re-render this effect
}, [themeToSet, setTheme]);
}, [themeToSet, setTheme, embedTheme, activeTheme]);
return {
resolvedTheme,