@devries-cameron20 / t3code Mirror · read-only / commits / 01e634a10b
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, 05:30 UTC

refactor(web): scoped settings stay cached without "use memo" (#20767)

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

Julius Marminge committed Oct 16, 2026 at 23:18 UTC 01e634a10b05bca504c3165e78673b233c120270
1 file changed +7 -10
apps/web/src/components/settings/useScopedSettings.ts
+7 -10
@@ -9,7 +9,6 @@ import * as Cause from "effect/Cause";
9 import { AsyncResult } from "effect/reactivity";
10 import {
11 DEFAULT_SERVER_SETTINGS,
12 - type ClientSettings,
12 type ProjectScopedServerSettingKey,
13 type ServerSettings,
14 type UnifiedSettings,
@@ -36,20 +35,18 @@ import {
35 type ScopedSettingsPatch,
36 } from "./scopedSettings";
37
39 -// Callers often pass an inline selector; a separate hook keeps the merge cached across those.
40 -function useMergedSettings(serverSettings: ServerSettings, clientSettings: ClientSettings) {
41 - "use memo";
42 - return mergeEnvironmentSettings(serverSettings, clientSettings);
38 +// Returns the merged object alone so the selector, often inline, cannot widen its cache key.
39 +function useScopedMergedSettings(): UnifiedSettings {
40 + const { target } = useSettingsScope();
41 + const clientSettings = useClientSettings();
42 + useMigrateModelPreferences(target?.environmentId ?? null, target?.settings ?? null);
43 + return mergeEnvironmentSettings(target?.settings ?? DEFAULT_SERVER_SETTINGS, clientSettings);
44 }
45
46 export function useScopedSettings<T = UnifiedSettings>(
47 selector?: (settings: UnifiedSettings) => T,
48 ): T {
48 - const { target } = useSettingsScope();
49 - const clientSettings = useClientSettings();
50 - const serverSettings = target?.settings ?? DEFAULT_SERVER_SETTINGS;
51 - useMigrateModelPreferences(target?.environmentId ?? null, target?.settings ?? null);
52 - const settings = useMergedSettings(serverSettings, clientSettings);
49 + const settings = useScopedMergedSettings();
50 return selector ? selector(settings) : (settings as T);
51 }
52