From a3a854b4ac2ef7a694936a684e66245bd6c89041 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Thu, 6 Jul 2023 11:22:13 -0400 Subject: [PATCH] fix theme preference restoring --- components/ThemeScript/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ThemeScript/client.js b/components/ThemeScript/client.js index 6925f886..1c7733d6 100644 --- a/components/ThemeScript/client.js +++ b/components/ThemeScript/client.js @@ -14,7 +14,7 @@ export const clientScript = () => { // restore the local storage preference if it's set, otherwise test CSS media query for browser dark mode preference // https://stackoverflow.com/a/57795495/1438024 - const newTheme = (pref && pref === "dark") || window.matchMedia("__MEDIA_QUERY__").matches ? 1 : 0; + const newTheme = (pref && pref === "dark") ?? window.matchMedia("__MEDIA_QUERY__").matches ? 1 : 0; // remove both `classNames` to start fresh... classList.remove(classNames[0], classNames[1]);