Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): validate monospace fonts on pick instead of scanning the catalog #7494

Closedeggfriedrice24(GitHub profile, opens in a new tab)wants to merge 9 commits intomain fromrefs/pull/7494/headopened View on GitHub

Showing 3 changed files with 152 additions and 16 deletions.

x
0 of 3 viewed, 3 left
27 additions and 5 deletionsapps/web/src/components/settings/FontFamilyPicker.tsxModified
View file
@@ -2,6 +2,7 @@
import { CheckIcon, ChevronDownIcon } from "lucide-react";
import { useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
import { isMonospaceFamily, queryInstalledFontFamilies } from "../../appearanceFonts";
+import { stackedThreadToast, toastManager } from "../ui/toast";
import {
Combobox,
ComboboxEmpty,
@@ -115,6 +116,7 @@
defaultFamily: string;
/** Committed family name; empty string means the default is in use. */
selectedFamily: string;
+ /** Probe the picked family and reject proportional faces (code, terminal). */
requireMonospace?: boolean;
/** Open the popup on mount — set when the control upgrades under focus. */
initialOpen?: boolean;
@@ -139,10 +141,13 @@
if (nextOpen) setQuery("");
​
- const families = useMemo(() => {
- if (enumeration.status !== "granted") return [];
- return requireMonospace ? enumeration.families.filter(isMonospaceFamily) : enumeration.families;
- }, [enumeration, requireMonospace]);
+ // The full catalog, always: classifying every installed family up front is
+ // an unbounded canvas measurement loop that freezes the renderer on large
+ // catalogs. Monospace enforcement happens on pick instead.
+ const families = useMemo(