@devries-cameron20 / t3code Mirror · read-only / commits / 5b7f6bcfbc
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 24, 09:00 UTC

refactor(mobile): remove write-only terminal font cache (#10058)

Julius Marminge committed Sep 5, 2026 at 01:49 UTC 5b7f6bcfbcd5f150a67f323e0ec5aeb70b3c4009
3 files changed +1 -27
apps/mobile/src/features/settings/appearance/AppearancePreferencesProvider.tsx
+1 -3
@@ -37,7 +37,6 @@ import {
37 getMobileUniwindThemeName,
38 type MobileThemeRuntimeState,
39 } from "../../../lib/mobileThemeRuntime";
40 -import { cacheTerminalFontSize } from "../../terminal/terminalUiState";
40
41 interface AppearancePreferencesContextValue {
42 /** Effective values with base-size derivation applied. Use this for rendering. */
@@ -143,8 +142,7 @@ export function AppearancePreferencesProvider(props: { readonly children: ReactN
142 useLayoutEffect(() => {
143 selectedThemeIdsRef.current = themeIds;
144 syncThemeRuntime(runtimeState);
146 - cacheTerminalFontSize(appearance.terminalFontSize);
147 - }, [appearance.terminalFontSize, runtimeState, syncThemeRuntime, themeIds]);
145 + }, [runtimeState, syncThemeRuntime, themeIds]);
146
147 const setThemeIdForAppearance = useCallback(
148 (appearance: MobileThemeAppearance, value: MobileThemeId) => {
apps/mobile/src/features/terminal/terminalUiState.test.ts
-10
@@ -2,9 +2,7 @@ import { beforeEach, describe, expect, it } from "vite-plus/test";
2 import { EnvironmentId, ThreadId } from "@t3tools/contracts";
3
4 import {
5 - cacheTerminalFontSize,
5 cacheTerminalGridSize,
7 - getCachedTerminalFontSize,
6 getCachedTerminalGridSize,
7 resetTerminalUiStateCaches,
8 } from "./terminalUiState";
@@ -14,14 +12,6 @@ describe("terminalUiState", () => {
12 resetTerminalUiStateCaches();
13 });
14
17 - it("caches terminal font size using the shared normalization rules", () => {
18 - expect(getCachedTerminalFontSize()).toBeNull();
19 - expect(cacheTerminalFontSize(8.5)).toBe(8.5);
20 - expect(getCachedTerminalFontSize()).toBe(8.5);
21 - expect(cacheTerminalFontSize(100)).toBe(14);
22 - expect(getCachedTerminalFontSize()).toBe(14);
23 - });
24 -
15 it("stores terminal grid sizes per terminal target", () => {
16 const primaryTarget = {
17 environmentId: EnvironmentId.make("env-1"),
apps/mobile/src/features/terminal/terminalUiState.ts
-14
@@ -1,7 +1,5 @@
1 import type { EnvironmentId, ThreadId } from "@t3tools/contracts";
2
3 -import { DEFAULT_TERMINAL_FONT_SIZE, normalizeTerminalFontSize } from "./terminalPreferences";
4 -
3 export interface TerminalGridSize {
4 readonly cols: number;
5 readonly rows: number;
@@ -14,22 +12,11 @@ export interface TerminalUiStateTarget {
12 }
13
14 const terminalGridSizeCache = new Map<string, TerminalGridSize>();
17 -let cachedTerminalFontSize: number | null = null;
15
16 function terminalUiStateKey(target: TerminalUiStateTarget): string {
17 return `${target.environmentId}:${target.threadId}:${target.terminalId}`;
18 }
19
23 -export function getCachedTerminalFontSize(): number | null {
24 - return cachedTerminalFontSize;
25 -}
26 -
27 -export function cacheTerminalFontSize(value: number | null | undefined): number {
28 - const normalized = normalizeTerminalFontSize(value ?? DEFAULT_TERMINAL_FONT_SIZE);
29 - cachedTerminalFontSize = normalized;
30 - return normalized;
31 -}
32 -
20 export function getCachedTerminalGridSize(target: TerminalUiStateTarget): TerminalGridSize | null {
21 return terminalGridSizeCache.get(terminalUiStateKey(target)) ?? null;
22 }
@@ -47,6 +34,5 @@ export function cacheTerminalGridSize(
34 }
35
36 export function resetTerminalUiStateCaches() {
50 - cachedTerminalFontSize = null;
37 terminalGridSizeCache.clear();
38 }