TypeScript
perf(web): useHtmlRenderTheme compiles without manual memoization (#20642)
Julius Marmingef63f0261d122
diff --git a/apps/web/src/hooks/useHtmlRenderTheme.ts b/apps/web/src/hooks/useHtmlRenderTheme.tsindex 5b263570154..99ac26c5724 100644--- a/apps/web/src/hooks/useHtmlRenderTheme.ts+++ b/apps/web/src/hooks/useHtmlRenderTheme.ts@@ -1,5 +1,5 @@import { HTML_RENDER_DEFAULT_FONTS, htmlRenderTheme } from "@t3tools/shared/htmlRender";-import { useMemo, useSyncExternalStore } from "react";+import { useSyncExternalStore } from "react";import { appearanceFontStack } from "../appearanceFonts";import {@@ -37,18 +37,14 @@ export function useHtmlRenderTheme() {);const sans = useClientSettings((settings) => settings.fontFamilySans);const mono = useClientSettings((settings) => settings.fontFamilyCode);- return useMemo(- () =>- htmlRenderTheme(- Object.fromEntries(- Object.entries(colors).map(([role, color]) => [role, themeColorToHex(color) ?? color]),- ) as typeof colors,- resolvedTheme,- {- sans: appearanceFontStack(sans, HTML_RENDER_DEFAULT_FONTS.sans),- mono: appearanceFontStack(mono, HTML_RENDER_DEFAULT_FONTS.mono),- },- ),- [colors, resolvedTheme, sans, mono],+ return htmlRenderTheme(+ Object.fromEntries(+ Object.entries(colors).map(([role, color]) => [role, themeColorToHex(color) ?? color]),+ ) as typeof colors,+ resolvedTheme,+ {+ sans: appearanceFontStack(sans, HTML_RENDER_DEFAULT_FONTS.sans),+ mono: appearanceFontStack(mono, HTML_RENDER_DEFAULT_FONTS.mono),+ },);}