Skip to content

Commit

Permalink
fix: Account disconnect on theme change
Browse files Browse the repository at this point in the history
  • Loading branch information
garethfuller committed Jan 17, 2025
1 parent 97c7715 commit 4c1e6e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/frontend-v3/lib/services/chakra/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { ChakraProvider, ThemeTypings } from '@chakra-ui/react'
import { ReactNode } from 'react'
import { ReactNode, useMemo } from 'react'
import { theme as balTheme } from './themes/bal/bal.theme'
import { theme as cowTheme } from './themes/cow/cow.theme'
import { useCow } from '@repo/lib/modules/cow/useCow'
Expand All @@ -17,14 +17,16 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
return balTheme
}

// eslint-disable-next-line react-hooks/exhaustive-deps
const theme = useMemo(() => getTheme(), [isCowPath, isCowVariant])

// Avoid hydration error in turbopack mode
if (!isMounted) return null

return (
<ChakraProvider
cssVarsRoot="body"
key={isCowPath ? 'cow' : 'bal'}
theme={getTheme()}
theme={theme}
toastOptions={{ defaultOptions: { position: 'bottom-left' } }}
>
{children}
Expand Down

0 comments on commit 4c1e6e4

Please sign in to comment.