File tree 1 file changed +8
-9
lines changed
site/src/pages/WorkspacePage
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -98,15 +98,14 @@ export const WorkspaceReadyPage = ({
98
98
...templateVersion ( workspace . template_active_version_id ) ,
99
99
enabled : workspace . outdated ,
100
100
} ) ;
101
- const [ systemTheme ] = useState ( ( ) => {
102
- if ( typeof window . matchMedia === "undefined" ) {
103
- // Default to dark mode!
104
- return "dark" ;
101
+ const [ faviconTheme , setFaviconTheme ] = useState < "light" | "dark" > ( "dark" )
102
+ useEffect ( ( ) => {
103
+ if ( typeof window === "undefined" || ! window . matchMedia ) {
104
+ return
105
105
}
106
106
const isDark = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
107
- return isDark ? "dark" : "light" ;
108
- } ) ;
109
-
107
+ setFaviconTheme ( isDark ? "dark" : "light" )
108
+ } , [ ] )
110
109
const buildLogs = useWorkspaceBuildLogs ( workspace . latest_build . id ) ;
111
110
const shouldDisplayBuildLogs =
112
111
hasJobError ( workspace ) ||
@@ -132,12 +131,12 @@ export const WorkspaceReadyPage = ({
132
131
< link
133
132
rel = "alternate icon"
134
133
type = "image/png"
135
- href = { `/favicons/${ favicon } -${ systemTheme } .png` }
134
+ href = { `/favicons/${ favicon } -${ faviconTheme } .png` }
136
135
/>
137
136
< link
138
137
rel = "icon"
139
138
type = "image/svg+xml"
140
- href = { `/favicons/${ favicon } -${ systemTheme } .svg` }
139
+ href = { `/favicons/${ favicon } -${ faviconTheme } .svg` }
141
140
/>
142
141
</ Helmet >
143
142
You can’t perform that action at this time.
0 commit comments