Skip to content

Commit

Permalink
fix: import ThemeToggle directly, fix hydration error
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Dec 7, 2023
1 parent 452ab5c commit 98faaa4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions ee/tabby-ui/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ import * as React from 'react'
import { cn } from '@/lib/utils'
import { buttonVariants } from '@/components/ui/button'
import { IconGitHub, IconNotice } from '@/components/ui/icons'
import dynamic from 'next/dynamic'
import Link from 'next/link'
import { useHealth } from '@/lib/hooks/use-health'
import { ReleaseInfo, useLatestRelease } from '@/lib/hooks/use-latest-release'
import { compare } from 'compare-versions'
import { useWorkers } from '@/lib/hooks/use-workers'
import { WorkerKind } from '@/lib/gql/generates/graphql'
import { has } from 'lodash-es'

const ThemeToggle = dynamic(
() => import('@/components/theme-toggle').then(x => x.ThemeToggle),
{ ssr: false }
)
import { ThemeToggle } from './theme-toggle'

export function Header() {
const { data } = useHealth()
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-ui/components/theme-toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function ThemeToggle() {
})
}}
>
{!theme ? null : theme === 'dark' ? (
{theme === 'dark' ? (
<IconMoon className="transition-all" />
) : (
<IconSun className="transition-all" />
Expand Down

0 comments on commit 98faaa4

Please sign in to comment.