File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -192,15 +192,12 @@ export function startClientSideIsDarkLogic(params: {
192192
193193 const isDarkFromOsPreference = getSystemColorScheme ( ) === "dark" ;
194194
195- const isDarkFallback = false ;
196-
197195 return {
198- "ssrWasPerformedWithIsDark" : isDarkExplicitlyProvidedAsParameter ?? isDarkFallback ,
196+ "ssrWasPerformedWithIsDark" : isDarkExplicitlyProvidedAsParameter ?? false ,
199197 "clientSideIsDark" :
200198 isDarkFromLocalStorage ??
201199 isDarkExplicitlyProvidedAsParameter ??
202- isDarkFromOsPreference ??
203- isDarkFallback
200+ isDarkFromOsPreference
204201 } ;
205202 } ) ( ) ;
206203
Original file line number Diff line number Diff line change @@ -27,6 +27,20 @@ export const getScriptToRunAsap: GetScriptToRunAsap = ({
2727 const sanitizer = typeof trustedTypes !== "undefined" ? trustedTypes.createPolicy("${ trustedTypesPolicyName } -asap", { createHTML: s => s }) : {
2828 createHTML: s => s,
2929 };
30+
31+ reset_persisted_value_if_website_config_changed: {
32+ const localStorageKey = "scheme-website-config-default";
33+
34+ const localStorageValue = localStorage.getItem(localStorageKey);
35+
36+ if (localStorageValue === "${ defaultColorScheme } ") {
37+ break reset_persisted_value_if_website_config_changed;
38+ }
39+
40+ localStorage.removeItem("scheme");
41+
42+ localStorage.setItem(localStorageKey, "${ defaultColorScheme } ");
43+ }
3044
3145 const isDark = (() => {
3246
@@ -62,19 +76,16 @@ export const getScriptToRunAsap: GetScriptToRunAsap = ({
6276
6377 const isDarkFromOsPreference = (() => {
6478 if (!window.matchMedia) {
65- return undefined ;
79+ return false ;
6680 }
6781
6882 return window.matchMedia("(prefers-color-scheme: dark)").matches;
6983 })();
7084
71- const isDarkFallback = false;
72-
7385 return (
7486 isDarkFromLocalStorage ??
7587 isDarkExplicitlyProvidedAsParameter ??
76- isDarkFromOsPreference ??
77- isDarkFallback
88+ isDarkFromOsPreference
7889 );
7990
8091 })();
You can’t perform that action at this time.
0 commit comments