@devries-cameron20 / t3code Mirror · read-only / commits / 0b0f4dbf26
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, 06:45 UTC

perf(web): the source control settings compile with the React Compiler (#20628)

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

Julius Marminge committed Oct 16, 2026 at 21:59 UTC 0b0f4dbf2671e0fcb3aaa13b8d3df20412ba14cc
1 file changed +24 -17
apps/web/src/components/settings/SourceControlSettings.tsx
+24 -17
@@ -2,7 +2,7 @@ import { RefreshIcon } from "~/components/ui/refresh-icon";
2 import { ChevronDownIcon } from "lucide-react";
3 import * as Duration from "effect/Duration";
4 import * as Option from "effect/Option";
5 -import { useEffect, useState, type ReactNode } from "react";
5 +import { useState, type ReactNode } from "react";
6 import type {
7 BackgroundActivitySettings,
8 SourceControlDiscoveryResult,
@@ -161,24 +161,31 @@ function itemStatusDot(item: VcsDiscoveryItem | SourceControlProviderDiscoveryIt
161 return "bg-success";
162 }
163
164 +function sourceControlItemIcon(
165 + item: VcsDiscoveryItem | SourceControlProviderDiscoveryItem,
166 +): ReactNode {
167 + const host = isProviderDiscoveryItem(item) ? sourceControlClients.find(item.kind) : undefined;
168 + const Icon = isProviderDiscoveryItem(item)
169 + ? host && sourceControlIcon(host)
170 + : VCS_ICONS[item.kind];
171 + return Icon ? <Icon className="size-4.5 text-foreground/80" aria-hidden /> : null;
172 +}
173 +
174 function SourceControlItemMark({
175 item,
176 }: {
177 readonly item: VcsDiscoveryItem | SourceControlProviderDiscoveryItem;
178 }) {
179 const dotClassName = itemStatusDot(item);
170 - const host = isProviderDiscoveryItem(item) ? sourceControlClients.find(item.kind) : undefined;
171 - const Icon = isProviderDiscoveryItem(item)
172 - ? host && sourceControlIcon(host)
173 - : VCS_ICONS[item.kind];
180 + const icon = sourceControlItemIcon(item);
181
175 - if (!Icon) {
182 + if (!icon) {
183 return <span className={cn("size-2 shrink-0 rounded-full", dotClassName)} aria-hidden />;
184 }
185
186 return (
187 <span className="relative inline-flex size-5 shrink-0 items-center justify-center">
181 - <Icon className="size-4.5 text-foreground/80" aria-hidden />
188 + {icon}
189 <span
190 className={cn(
191 "pointer-events-none absolute -left-0.5 -top-0.5 size-2 rounded-full ring-2 ring-background",
@@ -269,16 +276,16 @@ function DiscoveryItemRow({
276 const [isExpanded, setIsExpanded] = useState(false);
277 const hasDetails = children !== undefined;
278 const searchTargetId = useSettingsSearchTargetId();
272 -
273 - useEffect(() => {
274 - if (
275 - (item.kind === "git" && searchTargetId === searchableSetting("git-fetch-interval").id) ||
276 - searchTargetId === sourceControlHostSettingsSearchId(item.kind) ||
277 - (item.kind === "github" && searchTargetId === searchableSetting("github-accounts").id)
278 - ) {
279 - setIsExpanded(true);
280 - }
281 - }, [item.kind, searchTargetId]);
279 + // A search jump to a setting inside this row opens it when the target arrives.
280 + const [seenSearchTargetId, setSeenSearchTargetId] = useState<string | null>(null);
281 + const targetsThisRow =
282 + (item.kind === "git" && searchTargetId === searchableSetting("git-fetch-interval").id) ||
283 + searchTargetId === sourceControlHostSettingsSearchId(item.kind) ||
284 + (item.kind === "github" && searchTargetId === searchableSetting("github-accounts").id);
285 + if (targetsThisRow && !isExpanded && seenSearchTargetId !== searchTargetId) {
286 + setIsExpanded(true);
287 + }
288 + if (seenSearchTargetId !== searchTargetId) setSeenSearchTargetId(searchTargetId);
289
290 return (
291 <div