@devries-cameron20 / t3code Mirror · read-only / commits / a8dcb960d0
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 provider accent color picker compiles without manual memoization (#20612)

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

Julius Marminge committed Oct 16, 2026 at 22:01 UTC a8dcb960d0d14c5750b25c0a04cd062b4cb0dc57
1 file changed +28 -34
apps/web/src/components/settings/ProviderAccentColorPicker.tsx
+28 -34
@@ -1,7 +1,7 @@
1 "use client";
2
3 import { PlusIcon, XIcon } from "lucide-react";
4 -import { useCallback, useEffect, useRef, useState } from "react";
4 +import { useEffect, useRef, useState } from "react";
5
6 import { hexToHsv, hsvToHex, type HsvColor } from "../../lib/color";
7 import { ColorHueSlider, ColorSaturationValuePlane } from "../ui/color-picker";
@@ -21,13 +21,10 @@ function ProviderCustomColorPanel(props: {
21 const currentColor = hsvToHex(hsv.h, hsv.s, hsv.v);
22 const [hexDraft, setHexDraft] = useState<string | null>(null);
23
24 - const commitHsv = useCallback(
25 - (nextHsv: HsvColor) => {
26 - setHsv(nextHsv);
27 - onCommit(hsvToHex(nextHsv.h, nextHsv.s, nextHsv.v));
28 - },
29 - [onCommit],
30 - );
24 + const commitHsv = (nextHsv: HsvColor) => {
25 + setHsv(nextHsv);
26 + onCommit(hsvToHex(nextHsv.h, nextHsv.s, nextHsv.v));
27 + };
28
29 return (
30 <div className="w-56 bg-popover">
@@ -161,36 +158,33 @@ export function ProviderAccentColorPicker(props: {
158 };
159 }, []);
160
164 - const commitAccentColor = useCallback(
165 - (value: string) => {
166 - const normalizedValue = normalizeProviderAccentColor(value) ?? "";
167 - setOptimisticValue(normalizedValue);
168 -
169 - if (commitDelayMs <= 0) {
170 - pendingCommitRef.current = null;
171 - if (commitTimeoutRef.current !== null) {
172 - clearTimeout(commitTimeoutRef.current);
173 - commitTimeoutRef.current = null;
174 - }
175 - onCommit(normalizedValue);
176 - return;
177 - }
161 + const commitAccentColor = (value: string) => {
162 + const normalizedValue = normalizeProviderAccentColor(value) ?? "";
163 + setOptimisticValue(normalizedValue);
164
179 - pendingCommitRef.current = normalizedValue;
165 + if (commitDelayMs <= 0) {
166 + pendingCommitRef.current = null;
167 if (commitTimeoutRef.current !== null) {
168 clearTimeout(commitTimeoutRef.current);
182 - }
183 - commitTimeoutRef.current = setTimeout(() => {
169 commitTimeoutRef.current = null;
185 - const pendingCommit = pendingCommitRef.current;
186 - pendingCommitRef.current = null;
187 - if (pendingCommit !== null) {
188 - onCommitRef.current(pendingCommit);
189 - }
190 - }, commitDelayMs);
191 - },
192 - [commitDelayMs, onCommit],
193 - );
170 + }
171 + onCommit(normalizedValue);
172 + return;
173 + }
174 +
175 + pendingCommitRef.current = normalizedValue;
176 + if (commitTimeoutRef.current !== null) {
177 + clearTimeout(commitTimeoutRef.current);
178 + }
179 + commitTimeoutRef.current = setTimeout(() => {
180 + commitTimeoutRef.current = null;
181 + const pendingCommit = pendingCommitRef.current;
182 + pendingCommitRef.current = null;
183 + if (pendingCommit !== null) {
184 + onCommitRef.current(pendingCommit);
185 + }
186 + }, commitDelayMs);
187 + };
188
189 const normalized = normalizeProviderAccentColor(optimisticValue);
190 const picker = (