From 4faa853c4cf30066d230be55d6643e43226ab435 Mon Sep 17 00:00:00 2001 From: yohlo Date: Mon, 25 Aug 2025 19:36:47 -0500 Subject: [PATCH] fix hydration warning --- src/lib/mantine/mantine-provider.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/mantine/mantine-provider.tsx b/src/lib/mantine/mantine-provider.tsx index f51b906..a81a0d3 100644 --- a/src/lib/mantine/mantine-provider.tsx +++ b/src/lib/mantine/mantine-provider.tsx @@ -1,6 +1,7 @@ import { useAuth } from "@/contexts/auth-context"; import { createTheme, MantineProvider as MantineProviderCore } from "@mantine/core"; import ColorSchemeProvider from "./color-scheme-provider"; +import { useState, useEffect } from "react"; const commonInputStyles = { label: { @@ -45,10 +46,18 @@ const theme = createTheme({ const MantineProvider = ({ children }: { children: React.ReactNode }) => { const { metadata } = useAuth() + const [isHydrated, setIsHydrated] = useState(false) + + useEffect(() => { + setIsHydrated(true) + }, []) + + const colorScheme = isHydrated ? (metadata.colorScheme || 'auto') : 'auto' + const primaryColor = isHydrated ? (metadata.accentColor || 'blue') : 'blue' return {children}