@devries-cameron20 / t3code-1 / commits / 8beba3e16b
Fork 0

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

Refactor Sidebar component to streamline keybindings handling

Julius Marminge committed Feb 15, 2026 at 12:11 UTC 8beba3e16b9bc6066d20f64cf672c05e0576df40
1 file changed +4 -5
apps/web/src/components/Sidebar.tsx
+4 -5
@@ -1,6 +1,5 @@
1 import { MonitorIcon, MoonIcon, SunIcon, TerminalIcon } from "lucide-react";
2 import { useCallback, useEffect, useMemo, useState } from "react";
3 -import type { KeybindingsConfig } from "@t3tools/contracts";
3 import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4 import { isElectron } from "../env";
5 import { useTheme } from "../hooks/useTheme";
@@ -20,7 +19,6 @@ import { serverConfigQueryOptions } from "../lib/serverReactQuery";
19 import { formatWorktreePathForDisplay, getOrphanedWorktreePathForThread } from "../worktreeCleanup";
20
21 const THEME_CYCLE = { system: "light", light: "dark", dark: "system" } as const;
23 -const EMPTY_KEYBINDINGS: KeybindingsConfig = [];
22
23 function formatRelativeTime(iso: string): string {
24 const diff = Date.now() - new Date(iso).getTime();
@@ -117,13 +115,14 @@ function terminalStatusIndicator(thread: Thread): TerminalStatusIndicator | null
115 export default function Sidebar() {
116 const { state, dispatch } = useStore();
117 const api = useNativeApi();
120 - const keybindingsQuery = useQuery({
118 + const { data: keybindings = [] } = useQuery({
119 ...serverConfigQueryOptions(api),
120 select: (config) => config.keybindings,
121 });
124 - const keybindings = keybindingsQuery.data ?? EMPTY_KEYBINDINGS;
122 const queryClient = useQueryClient();
126 - const removeWorktreeMutation = useMutation(gitRemoveWorktreeMutationOptions({ api, queryClient }));
123 + const removeWorktreeMutation = useMutation(
124 + gitRemoveWorktreeMutationOptions({ api, queryClient }),
125 + );
126 const { theme, setTheme } = useTheme();
127 const [addingProject, setAddingProject] = useState(false);
128 const [newCwd, setNewCwd] = useState("");