perf upgrade
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
MantineProvider as MantineProviderCore,
|
||||
} from "@mantine/core";
|
||||
import ColorSchemeProvider from "./color-scheme-provider";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
|
||||
const commonInputStyles = {
|
||||
label: {
|
||||
@@ -60,10 +60,15 @@ const MantineProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const colorScheme = isHydrated ? metadata.colorScheme || "auto" : "auto";
|
||||
const primaryColor = isHydrated ? metadata.accentColor || "blue" : "blue";
|
||||
|
||||
const themeWithPrimaryColor = useMemo(
|
||||
() => ({ ...theme, primaryColor }),
|
||||
[primaryColor]
|
||||
);
|
||||
|
||||
return (
|
||||
<MantineProviderCore
|
||||
defaultColorScheme={colorScheme}
|
||||
theme={{ ...theme, primaryColor }}
|
||||
theme={themeWithPrimaryColor}
|
||||
>
|
||||
<ColorSchemeProvider>{children}</ColorSchemeProvider>
|
||||
</MantineProviderCore>
|
||||
|
||||
Reference in New Issue
Block a user