fix:theme-flakiness (#20460)
This commit is contained in:
@@ -57,7 +57,7 @@ test.describe("Change App Theme Test", () => {
|
||||
|
||||
await page.waitForTimeout(3000);
|
||||
const themeValue = await page.evaluate(() => localStorage.getItem("app-theme"));
|
||||
expect(themeValue).toBe("system");
|
||||
expect(themeValue).toBe("light");
|
||||
|
||||
const systemTheme = await page.evaluate(() => {
|
||||
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
|
||||
@@ -11,7 +11,9 @@ import { useEmbedTheme } from "@calcom/embed-core/embed-iframe";
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export default function useTheme(themeToSet: "system" | (string & {}) | undefined | null, getOnly = false) {
|
||||
themeToSet = themeToSet ? themeToSet : "system";
|
||||
if (typeof window !== "undefined") {
|
||||
themeToSet = themeToSet || localStorage.getItem("app-theme") || "system";
|
||||
}
|
||||
const { resolvedTheme, setTheme, forcedTheme, theme: activeTheme } = useNextTheme();
|
||||
const embedTheme = useEmbedTheme();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user