File tree Expand file tree Collapse file tree 3 files changed +5
-29
lines changed Expand file tree Collapse file tree 3 files changed +5
-29
lines changed Original file line number Diff line number Diff line change 38
38
39
39
gtag ( 'config' , 'UA-125599395-1' ) ;
40
40
</ script >
41
- < script >
42
- function loadTheme ( ) {
43
- try {
44
- const theme = localStorage . getItem ( 'theme' )
45
- if ( ! theme )
46
- return
47
- document . body . dataset . theme = theme
48
- } catch ( e ) {
49
41
50
- }
51
- }
52
- loadTheme ( )
53
- </ script >
54
42
55
43
< title > React App</ title >
56
44
</ head >
Original file line number Diff line number Diff line change @@ -256,8 +256,13 @@ const MarkdownEditorContainer: React.FC<MarkdownEditorContainerProps> = () => {
256
256
257
257
useSaveHotKey ( ( ) => onTempSave ( true ) ) ;
258
258
259
+ const isReady = useSelector (
260
+ ( state : RootState ) => state . darkMode . systemTheme !== 'not-ready' ,
261
+ ) ;
259
262
const theme = useTheme ( ) ;
260
263
264
+ if ( ! isReady ) return null ;
265
+
261
266
return (
262
267
< >
263
268
< Helmet >
Original file line number Diff line number Diff line change @@ -85,23 +85,6 @@ function Html({
85
85
gtag('config', 'UA-125599395-1');` ,
86
86
} }
87
87
> </ script >
88
- < script
89
- dangerouslySetInnerHTML = { {
90
- __html : `
91
- function loadTheme() {
92
- try {
93
- const theme = localStorage.getItem('theme')
94
- if (!theme)
95
- return
96
- document.body.dataset.theme = theme
97
- } catch (e) {
98
-
99
- }
100
- }
101
- loadTheme()
102
- ` ,
103
- } }
104
- > </ script >
105
88
</ head >
106
89
< body data-theme = { theme } >
107
90
< div id = "root" dangerouslySetInnerHTML = { { __html : content } } > </ div >
You can’t perform that action at this time.
0 commit comments