@devries-cameron20 / t3code Mirror · read-only / commits / 549043863a
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 25, 06:15 UTC

fix: guard against missing sidebarProjectGroupingOverrides in client settings (#2099)

Julius Marminge committed Apr 16, 2026 at 19:36 UTC 549043863a3ca1f955c66fd31bda27ea3dc97c18
4 files changed +18 -5
apps/desktop/src/clientPersistence.ts
+15 -2
@@ -1,8 +1,13 @@
1 import * as FS from "node:fs";
2 import * as Path from "node:path";
3
4 -import type { ClientSettings, PersistedSavedEnvironmentRecord } from "@t3tools/contracts";
4 +import {
5 + ClientSettingsSchema,
6 + type ClientSettings,
7 + type PersistedSavedEnvironmentRecord,
8 +} from "@t3tools/contracts";
9 import { Predicate } from "effect";
10 +import * as Schema from "effect/Schema";
11
12 interface ClientSettingsDocument {
13 readonly settings: ClientSettings;
@@ -83,7 +88,15 @@ function toPersistedSavedEnvironmentRecord(
88 }
89
90 export function readClientSettings(settingsPath: string): ClientSettings | null {
86 - return readJsonFile<ClientSettingsDocument>(settingsPath)?.settings ?? null;
91 + const raw = readJsonFile<ClientSettingsDocument>(settingsPath)?.settings;
92 + if (!raw) {
93 + return null;
94 + }
95 + try {
96 + return Schema.decodeUnknownSync(ClientSettingsSchema)(raw);
97 + } catch {
98 + return null;
99 + }
100 }
101
102 export function writeClientSettings(settingsPath: string, settings: ClientSettings): void {
apps/web/src/components/Sidebar.tsx
+1 -1
@@ -1379,7 +1379,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
1379 const overrideKey = deriveProjectGroupingOverrideKey(member);
1380 setProjectGroupingTarget(member);
1381 setProjectGroupingSelection(
1382 - projectGroupingSettings.sidebarProjectGroupingOverrides[overrideKey] ?? "inherit",
1382 + projectGroupingSettings.sidebarProjectGroupingOverrides?.[overrideKey] ?? "inherit",
1383 );
1384 },
1385 [projectGroupingSettings.sidebarProjectGroupingOverrides],
apps/web/src/hooks/useSettings.ts
+1 -1
@@ -64,7 +64,7 @@ async function hydrateClientSettings(): Promise<void> {
64 try {
65 const persistedSettings = await ensureLocalApi().persistence.getClientSettings();
66 if (persistedSettings) {
67 - replaceClientSettingsSnapshot(persistedSettings);
67 + replaceClientSettingsSnapshot({ ...DEFAULT_CLIENT_SETTINGS, ...persistedSettings });
68 }
69 } catch (error) {
70 console.error(`${CLIENT_SETTINGS_PERSISTENCE_ERROR_SCOPE} hydrate failed`, error);
apps/web/src/logicalProject.ts
+1 -1
@@ -70,7 +70,7 @@ export function resolveProjectGroupingMode(
70 settings: ProjectGroupingSettings,
71 ): SidebarProjectGroupingMode {
72 return (
73 - settings.sidebarProjectGroupingOverrides[deriveProjectGroupingOverrideKey(project)] ??
73 + settings.sidebarProjectGroupingOverrides?.[deriveProjectGroupingOverrideKey(project)] ??
74 settings.sidebarProjectGroupingMode
75 );
76 }