Skip to content

Commit a579094

Browse files
committed
fixes theme bug for ssr enabled pages
1 parent cbea3f8 commit a579094

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

resources/js/components/sidebar/team-switcher.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function TeamSwitcher() {
1313
<GalleryVerticalEnd className="size-5 fill-current text-white dark:text-black" />
1414
</div>
1515
<div className="ml-1 grid flex-1 text-left text-sm">
16-
<span className="mb-0.5 truncate leading-tight font-normal">
16+
<span className="mb-0.5 truncate leading-none font-semibold">
1717
Adonis + React Starter Kit
1818
</span>
1919
</div>

resources/js/features/theme/theme-provider.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ export function ThemeProvider({
3333
storageKey = 'vite-ui-theme',
3434
...props
3535
}: ThemeProviderProps) {
36-
const [theme, setTheme] = useState<Theme>(
37-
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme
38-
)
36+
const [theme, setTheme] = useState<Theme>(() => {
37+
if (typeof window === 'undefined') {
38+
return defaultTheme
39+
}
40+
return (localStorage.getItem(storageKey) as Theme) || defaultTheme
41+
})
3942

4043
useEffect(() => {
4144
const root = window.document.documentElement

resources/js/pages/welcome.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Button } from '@/components/ui/button'
22
import { Head, Link } from '@inertiajs/react'
33

4-
export default function WelcomePage() {
4+
export default function Welcome() {
55
return (
66
<>
77
<Head title="Welcome">

0 commit comments

Comments
 (0)