Skip to content

Commit 7a680a2

Browse files
perf(web): useHtmlRenderTheme compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit 7a680a2

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

‎apps/web/src/hooks/useHtmlRenderTheme.ts‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HTML_RENDER_DEFAULT_FONTS, htmlRenderTheme } from "@t3tools/shared/htmlRender";
2-
import { useMemo, useSyncExternalStore } from "react";
2+
import { useSyncExternalStore } from "react";
33

44
import { appearanceFontStack } from "../appearanceFonts";
55
import {
@@ -37,18 +37,14 @@ export function useHtmlRenderTheme() {
3737
);
3838
const sans = useClientSettings((settings) => settings.fontFamilySans);
3939
const mono = useClientSettings((settings) => settings.fontFamilyCode);
40-
return useMemo(
41-
() =>
42-
htmlRenderTheme(
43-
Object.fromEntries(
44-
Object.entries(colors).map(([role, color]) => [role, themeColorToHex(color) ?? color]),
45-
) as typeof colors,
46-
resolvedTheme,
47-
{
48-
sans: appearanceFontStack(sans, HTML_RENDER_DEFAULT_FONTS.sans),
49-
mono: appearanceFontStack(mono, HTML_RENDER_DEFAULT_FONTS.mono),
50-
},
51-
),
52-
[colors, resolvedTheme, sans, mono],
40+
return htmlRenderTheme(
41+
Object.fromEntries(
42+
Object.entries(colors).map(([role, color]) => [role, themeColorToHex(color) ?? color]),
43+
) as typeof colors,
44+
resolvedTheme,
45+
{
46+
sans: appearanceFontStack(sans, HTML_RENDER_DEFAULT_FONTS.sans),
47+
mono: appearanceFontStack(mono, HTML_RENDER_DEFAULT_FONTS.mono),
48+
},
5349
);
5450
}

0 commit comments

Comments
 (0)