fix(dashboard): stop rendering mode-watcher init script as visible page text (#740)
createInitialModeExpression returns bare JS, not a script tag. Injecting it
via {@html} in svelte:head printed setInitialMode source on customer org
sites. Let ModeWatcher inject the script correctly instead.
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Rotimi Best <rotimi-best@users.noreply.github.com>
This commit is contained in:
co-authored by
Cursor Agent
Rotimi Best
parent
8288f157b3
commit
7392be04d7
@@ -1,19 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment';
|
||||
import {
|
||||
ModeWatcher,
|
||||
createInitialModeExpression,
|
||||
setMode,
|
||||
systemPrefersMode,
|
||||
userPrefersMode
|
||||
} from '@cio/ui/base/dark-mode';
|
||||
import { ModeWatcher, setMode, systemPrefersMode, userPrefersMode } from '@cio/ui/base/dark-mode';
|
||||
|
||||
import { MODE_STORAGE_KEY, readStoredColorMode } from '$lib/utils/functions/color-mode';
|
||||
|
||||
const initialModeScript = createInitialModeExpression({
|
||||
defaultMode: 'light',
|
||||
modeStorageKey: MODE_STORAGE_KEY
|
||||
});
|
||||
import { readStoredColorMode } from '$lib/utils/functions/color-mode';
|
||||
|
||||
$effect(() => {
|
||||
if (!browser) {
|
||||
@@ -29,9 +18,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||
{@html initialModeScript}
|
||||
</svelte:head>
|
||||
|
||||
<ModeWatcher defaultMode="light" disableHeadScriptInjection />
|
||||
<ModeWatcher defaultMode="light" />
|
||||
|
||||
Reference in New Issue
Block a user