@devries-cameron20 / t3code Mirror · read-only / commits / 855cd1650c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 06:45 UTC

perf(web): the font picker compiles with the React Compiler (#20594)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 22:03 UTC 855cd1650c73487b07ba6ee2cbf830670bc311c7
1 file changed +8 -9
apps/web/src/components/settings/FontFamilyPicker.tsx
+8 -9
@@ -1,6 +1,6 @@
1 import { LegendList, type LegendListRef } from "@legendapp/list/react";
2 import { CheckIcon } from "lucide-react";
3 -import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3 +import { useEffect, useRef, useState, useSyncExternalStore } from "react";
4 import { isMonospaceFamily, queryInstalledFontFamilies } from "../../appearanceFonts";
5 import {
6 Combobox,
@@ -103,9 +103,11 @@ export function FontFamilyPicker({
103 // its open state never receives Base UI's entrance style baseline, so the
104 // exit transition on close has no style delta, never fires transitionend,
105 // and the popup lingers on screen forever.
106 + const [openAfterMount] = useState(initialOpen);
107 useEffect(() => {
107 - if (initialOpen) setOpen(true);
108 - }, []);
108 + // oxlint-disable-next-line react/set-state-in-effect -- Base UI needs one closed commit first to record the popup's entrance style.
109 + if (openAfterMount) setOpen(true);
110 + }, [openAfterMount]);
111 const listRef = useRef<LegendListRef | null>(null);
112 const enumeration = useFontEnumeration();
113
@@ -114,12 +116,9 @@ export function FontFamilyPicker({
116 if (nextOpen) setQuery("");
117 };
118
117 - const families = useMemo(() => {
118 - if (enumeration.status !== "granted") return [];
119 - return enumeration.families;
120 - }, [enumeration]);
119 + const families = enumeration.status === "granted" ? enumeration.families : [];
120
122 - const items = useMemo(() => {
121 + const items = (() => {
122 const trimmedQuery = query.trim().toLowerCase();
123 const result: string[] = [];
124 if (trimmedQuery.length === 0) result.push(DEFAULT_FONT_VALUE);
@@ -129,7 +128,7 @@ export function FontFamilyPicker({
128 ),
129 );
130 return result;
132 - }, [query, families]);
131 + })();
132
133 const selectedValue = selectedFamily.length === 0 ? DEFAULT_FONT_VALUE : selectedFamily;
134