File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
custom-implementation/src Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,19 @@ const render = async () => {
17
17
*/
18
18
19
19
const data = await getPageData ( )
20
- const sidenav = document . querySelector ( 'button.fern-search-bar' )
21
- ?. parentElement as HTMLElement
22
20
23
21
const theme = document . getElementsByTagName ( 'html' ) [ 0 ] . getAttribute ( 'class' )
24
22
23
+ const sidenav = document . querySelector ( 'button.fern-search-bar' )
24
+ ?. parentElement as HTMLElement
25
+
25
26
if ( ! document . getElementById ( 'theme-switch' ) ) {
26
27
const wrapper = document . createElement ( 'div' )
27
28
wrapper . setAttribute ( 'id' , 'theme-switch' )
28
- sidenav . appendChild ( wrapper )
29
- ReactDOM . render ( React . createElement ( ThemeSwitch ) , wrapper )
29
+ if ( sidenav ) {
30
+ sidenav . appendChild ( wrapper )
31
+ ReactDOM . render ( React . createElement ( ThemeSwitch ) , wrapper )
32
+ }
30
33
}
31
34
32
35
ReactDOM . render (
You can’t perform that action at this time.
0 commit comments