@devries-cameron20 / t3code Mirror · read-only / commits / 62861700d8
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, 08:00 UTC

perf(web): the sidebar update pill compiles with the React Compiler (#20484)

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

Julius Marminge committed Oct 16, 2026 at 18:46 UTC 62861700d80182675371240bb3e9f75c9894cc63
2 files changed +28 -17
apps/web/reactCompiledFiles.ts
+1
@@ -59,4 +59,5 @@ export const REACT_COMPILED_FILES = [
59 "apps/web/src/components/ProviderUpdateEnvironmentRows.tsx",
60 "apps/web/src/components/files/useDirectoryEntries.ts",
61 "apps/web/src/components/files/FileBrowserPanel.tsx",
62 + "apps/web/src/components/sidebar/SidebarUpdatePill.tsx",
63 ] as const;
apps/web/src/components/sidebar/SidebarUpdatePill.tsx
+27 -17
@@ -1,7 +1,8 @@
1 import type { DesktopBridge, DesktopUpdateState } from "@t3tools/contracts";
2 import { TriangleAlertIcon } from "lucide-react";
3 -import { type ComponentProps, useCallback, useEffect, useId, useRef, useState } from "react";
3 +import { type ComponentProps, useEffect, useId, useRef, useState } from "react";
4 import { flushSync } from "react-dom";
5 +import { settlePromise, squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
6 import { isElectron } from "../../env";
7 import { useMediaQuery } from "../../hooks/useMediaQuery";
8 import { cn } from "../../lib/utils";
@@ -192,20 +193,28 @@ function SidebarUpdateControl() {
193 const [isActionPending, setIsActionPending] = useState(false);
194 const [isConfirmingEverything, setIsConfirmingEverything] = useState(false);
195 const [checkAnimationKey, setCheckAnimationKey] = useState(0);
195 - const [isCheckAnimationLatched, setIsCheckAnimationLatched] = useState(false);
196 const [releaseNotesPopoverHandle] = useState(() => PopoverCreateHandle());
197 const suppressReleaseNotesFocusOpen = useRef(false);
198 const releaseNotesPopupRef = useRef<HTMLDivElement>(null);
199 const releaseNotesTriggerId = useId();
200 const prefersReducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
201
202 - useEffect(() => {
202 + const updateStatus = state?.status;
203 + const [isCheckAnimationLatched, setIsCheckAnimationLatched] = useState(
204 + () => !prefersReducedMotion && updateStatus === "checking",
205 + );
206 + const [latchInputs, setLatchInputs] = useState({ prefersReducedMotion, updateStatus });
207 + if (
208 + latchInputs.prefersReducedMotion !== prefersReducedMotion ||
209 + latchInputs.updateStatus !== updateStatus
210 + ) {
211 + setLatchInputs({ prefersReducedMotion, updateStatus });
212 if (prefersReducedMotion) {
213 setIsCheckAnimationLatched(false);
205 - } else if (state?.status === "checking") {
214 + } else if (updateStatus === "checking") {
215 setIsCheckAnimationLatched(true);
216 }
208 - }, [prefersReducedMotion, state?.status]);
217 + }
218
219 const action = state ? resolveDesktopUpdateButtonAction(state) : "none";
220 const isDownloading = state?.status === "downloading";
@@ -259,7 +268,7 @@ function SidebarUpdateControl() {
268 }
269 }, [releaseNotesPopoverHandle, releaseNotesTriggerId, showReleaseNotesPopover]);
270
262 - const handleAction = useCallback(async () => {
271 + const handleAction = async () => {
272 const bridge = window.desktopBridge;
273 if (isInteractionDisabled) return;
274
@@ -330,14 +339,14 @@ function SidebarUpdateControl() {
339 );
340 })
341 .finally(() => setIsActionPending(false));
333 - }, [action, isInteractionDisabled, prefersReducedMotion, runsEverything, state]);
342 + };
343
335 - const runEverything = useCallback(async () => {
344 + const runEverything = async () => {
345 const bridge = window.desktopBridge;
346 setIsConfirmingEverything(false);
347 setIsActionPending(true);
339 - try {
340 - await everything.run({
348 + const result = await settlePromise(() =>
349 + everything.run({
350 ...(bridge && action === "download"
351 ? {
352 downloadLocal: (reportError) =>
@@ -347,8 +356,10 @@ function SidebarUpdateControl() {
356 ...(bridge && action !== "none"
357 ? { installLocal: (reportError) => installLocalUpdate(bridge, reportError) }
358 : {}),
350 - });
351 - } catch (error) {
359 + }),
360 + );
361 + if (result._tag === "Failure") {
362 + const error = squashAtomCommandFailure(result);
363 toastManager.add(
364 stackedThreadToast({
365 type: "error",
@@ -356,19 +367,18 @@ function SidebarUpdateControl() {
367 description: error instanceof Error ? error.message : "An unexpected error occurred.",
368 }),
369 );
359 - } finally {
360 - setIsActionPending(false);
370 }
362 - }, [action, everything]);
371 + setIsActionPending(false);
372 + };
373
364 - const handleCheckAnimationIteration = useCallback(() => {
374 + const handleCheckAnimationIteration = () => {
375 setIsCheckAnimationLatched(
376 shouldContinueDesktopUpdateCheckAnimation({
377 isChecking: state?.status === "checking",
378 prefersReducedMotion,
379 }),
380 );
371 - }, [prefersReducedMotion, state?.status]);
381 + };
382
383 if (!isElectron && !runsEverything && !isRunningEverything) return null;
384