File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- import { onMount , type Snippet } from ' svelte' ;
2
+ import { type Snippet } from ' svelte' ;
3
3
import HeadScript from ' ./head-script.svelte' ;
4
4
import { Theme } from ' ./theme.svelte.js' ;
5
5
import type { Config } from ' ./config.js' ;
6
- import { hasTheme } from ' ./index.js' ;
6
+ import { hasTheme , HydrationWatcher } from ' ./index.js' ;
7
7
import { setTheme } from ' ./context.js' ;
8
8
import { run } from ' svelte/legacy' ;
9
9
58
58
setTheme (theme );
59
59
}
60
60
61
- let hydrated = $state (false );
62
- onMount (() => {
63
- hydrated = true ;
64
- });
61
+ const watcher = new HydrationWatcher ();
65
62
66
63
run (() => {
67
64
if (enableSystem && ! themes .includes (' system' )) {
87
84
});
88
85
</script >
89
86
90
- {#if ! hydrated }
87
+ {#if ! watcher . hydrated }
91
88
<HeadScript
92
89
{attribute }
93
90
{storageKey }
You can’t perform that action at this time.
0 commit comments