@devries-cameron20 / t3code Mirror · read-only / commits / 123dc24504
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): diagnostics settings compile with the React Compiler (#20507)

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

Julius Marminge committed Oct 16, 2026 at 18:53 UTC 123dc2450484f6d2dabaf3a440e83aec2d8267b1
2 files changed +111 -112
apps/web/reactCompiledFiles.ts
+1
@@ -82,4 +82,5 @@ export const REACT_COMPILED_FILES = [
82 "apps/web/src/components/settings/NotificationSettings.tsx",
83 "apps/web/src/components/settings/ProviderSetupSection.tsx",
84 "apps/web/src/components/settings/StorageSettings.tsx",
85 + "apps/web/src/components/settings/DiagnosticsSettings.tsx",
86 ] as const;
apps/web/src/components/settings/DiagnosticsSettings.tsx
+110 -112
@@ -11,7 +11,7 @@ import {
11 isAtomCommandInterrupted,
12 squashAtomCommandFailure,
13 } from "@t3tools/client-runtime/state/runtime";
14 -import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
14 +import { useEffect, useRef, useState, type ReactNode } from "react";
15 import type {
16 ServerProcessDiagnosticsEntry,
17 ServerProcessResourceHistorySummary,
@@ -299,6 +299,28 @@ function ProcessNameCell({
299 );
300 }
301
302 +function visibleProcessTree(
303 + processes: ReadonlyArray<ServerProcessDiagnosticsEntry>,
304 + collapsedPids: ReadonlySet<number>,
305 +) {
306 + const visible: ServerProcessDiagnosticsEntry[] = [];
307 + let hiddenChildDepth: number | null = null;
308 +
309 + for (const process of processes) {
310 + if (hiddenChildDepth !== null) {
311 + if (process.depth > hiddenChildDepth) continue;
312 + hiddenChildDepth = null;
313 + }
314 +
315 + visible.push(process);
316 + if (collapsedPids.has(process.pid)) {
317 + hiddenChildDepth = process.depth;
318 + }
319 + }
320 +
321 + return visible;
322 +}
323 +
324 function ProcessDiagnosticsTable({
325 processes,
326 canMaintainEnvironment,
@@ -313,26 +335,9 @@ function ProcessDiagnosticsTable({
335 emptyLabel?: string;
336 }) {
337 const [collapsedPids, setCollapsedPids] = useState<ReadonlySet<number>>(() => new Set());
316 - const visibleProcesses = useMemo(() => {
317 - const visible: ServerProcessDiagnosticsEntry[] = [];
318 - let hiddenChildDepth: number | null = null;
319 -
320 - for (const process of processes) {
321 - if (hiddenChildDepth !== null) {
322 - if (process.depth > hiddenChildDepth) continue;
323 - hiddenChildDepth = null;
324 - }
325 -
326 - visible.push(process);
327 - if (collapsedPids.has(process.pid)) {
328 - hiddenChildDepth = process.depth;
329 - }
330 - }
338 + const visibleProcesses = visibleProcessTree(processes, collapsedPids);
339
332 - return visible;
333 - }, [collapsedPids, processes]);
334 -
335 - const toggleProcess = useCallback((pid: number) => {
340 + const toggleProcess = (pid: number) => {
341 setCollapsedPids((previous) => {
342 const next = new Set(previous);
343 if (next.has(pid)) {
@@ -342,7 +347,7 @@ function ProcessDiagnosticsTable({
347 }
348 return next;
349 });
345 - }, []);
350 + };
351
352 return (
353 <div className="border-t border-border/60">
@@ -783,7 +788,7 @@ export function DiagnosticsSettingsPanel() {
788 };
789 }, [environmentId]);
790
786 - const openLogsDirectory = useCallback(() => {
791 + const openLogsDirectory = () => {
792 const logsDirectoryPath = observability?.logsDirectoryPath ?? null;
793 if (!logsDirectoryPath) return;
794
@@ -806,7 +811,7 @@ export function DiagnosticsSettingsPanel() {
811 );
812 }
813 })();
809 - }, [environmentId, observability?.logsDirectoryPath, openInEditor]);
814 + };
815
816 const isInitialLoading = isPending && data === null;
817 const isProcessInitialLoading = isProcessPending && processData === null;
@@ -824,104 +829,97 @@ export function DiagnosticsSettingsPanel() {
829 ) {
830 setExportFormEnvironmentId(environmentId);
831 }
827 - const signalProcess = useCallback(
828 - async (pid: number, signal: ServerProcessSignal) => {
829 - const targetEnvironmentId = environmentIdRef.current;
830 - const process = processDataRef.current?.processes.find((entry) => entry.pid === pid);
831 - if (
832 - targetEnvironmentId === null ||
833 - process === undefined ||
834 - !readEnvironmentScope(targetEnvironmentId, AuthEnvironmentMaintainScope)
835 - )
836 - return;
837 - if (signalingPidRef.current !== null) return;
838 - signalingPidRef.current = pid;
839 - setSignalingPid(pid);
840 - const clearSignaling = () => {
841 - signalingPidRef.current = null;
842 - setSignalingPid(null);
843 - };
844 - if (signal === "SIGKILL") {
845 - let confirmed = false;
846 - try {
847 - confirmed = await ensureLocalApi().dialogs.confirm(
848 - `Send SIGKILL to process ${pid}? This cannot be handled by the process.`,
849 - { variant: "destructive" },
850 - );
851 - } catch (error) {
852 - clearSignaling();
853 - toastManager.add({
854 - type: "error",
855 - title: "Could not confirm signal",
856 - description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
857 - });
858 - return;
859 - }
860 - if (!confirmed) {
861 - clearSignaling();
862 - return;
863 - }
864 - }
865 - const currentEnvironmentId = environmentIdRef.current;
866 - if (
867 - currentEnvironmentId === null ||
868 - currentEnvironmentId !== targetEnvironmentId ||
869 - !readEnvironmentScope(currentEnvironmentId, AuthEnvironmentMaintainScope)
870 - ) {
832 + const signalProcess = async (pid: number, signal: ServerProcessSignal) => {
833 + const targetEnvironmentId = environmentIdRef.current;
834 + const process = processDataRef.current?.processes.find((entry) => entry.pid === pid);
835 + if (
836 + targetEnvironmentId === null ||
837 + process === undefined ||
838 + !readEnvironmentScope(targetEnvironmentId, AuthEnvironmentMaintainScope)
839 + )
840 + return;
841 + if (signalingPidRef.current !== null) return;
842 + signalingPidRef.current = pid;
843 + setSignalingPid(pid);
844 + const clearSignaling = () => {
845 + signalingPidRef.current = null;
846 + setSignalingPid(null);
847 + };
848 + if (signal === "SIGKILL") {
849 + let confirmed = false;
850 + try {
851 + confirmed = await ensureLocalApi().dialogs.confirm(
852 + `Send SIGKILL to process ${pid}? This cannot be handled by the process.`,
853 + { variant: "destructive" },
854 + );
855 + } catch (error) {
856 clearSignaling();
857 + toastManager.add({
858 + type: "error",
859 + title: "Could not confirm signal",
860 + description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
861 + });
862 return;
863 }
874 - if (
875 - processDataRef.current?.processes.find((entry) => entry.pid === pid)?.startTimeMs !==
876 - process.startTimeMs
877 - ) {
864 + if (!confirmed) {
865 clearSignaling();
866 return;
867 }
868 + }
869 + const currentEnvironmentId = environmentIdRef.current;
870 + if (
871 + currentEnvironmentId === null ||
872 + currentEnvironmentId !== targetEnvironmentId ||
873 + !readEnvironmentScope(currentEnvironmentId, AuthEnvironmentMaintainScope)
874 + ) {
875 + clearSignaling();
876 + return;
877 + }
878 + if (
879 + processDataRef.current?.processes.find((entry) => entry.pid === pid)?.startTimeMs !==
880 + process.startTimeMs
881 + ) {
882 + clearSignaling();
883 + return;
884 + }
885
882 - try {
883 - const result = await signalServerProcess({
884 - environmentId: targetEnvironmentId,
885 - input: { pid, startTimeMs: process.startTimeMs, signal },
886 + const result = await signalServerProcess({
887 + environmentId: targetEnvironmentId,
888 + input: { pid, startTimeMs: process.startTimeMs, signal },
889 + });
890 + clearSignaling();
891 + if (result._tag === "Failure") {
892 + if (!isAtomCommandInterrupted(result)) {
893 + const error = squashAtomCommandFailure(result);
894 + toastManager.add({
895 + type: "error",
896 + title: `Could not send ${signal}`,
897 + description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
898 });
887 - if (result._tag === "Failure") {
888 - if (!isAtomCommandInterrupted(result)) {
889 - const error = squashAtomCommandFailure(result);
890 - toastManager.add({
891 - type: "error",
892 - title: `Could not send ${signal}`,
893 - description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
894 - });
895 - }
896 - return;
897 - }
898 - if (!result.value.signaled) {
899 - const message = Option.getOrUndefined(result.value.message);
900 - refreshProcesses();
901 - if (isStaleProcessSignalMessage(message)) {
902 - toastManager.add({
903 - type: "info",
904 - title: "Process already exited",
905 - description:
906 - "The process is not a child of the T3 Server. It might already have exited.",
907 - });
908 - return;
909 - }
910 -
911 - toastManager.add({
912 - type: "error",
913 - title: `Could not send ${signal}`,
914 - description: message ?? `Failed to send ${signal}.`,
915 - });
916 - return;
917 - }
918 - refreshProcesses();
919 - } finally {
920 - clearSignaling();
899 }
922 - },
923 - [refreshProcesses, signalServerProcess],
924 - );
900 + return;
901 + }
902 + if (!result.value.signaled) {
903 + const message = Option.getOrUndefined(result.value.message);
904 + refreshProcesses();
905 + if (isStaleProcessSignalMessage(message)) {
906 + toastManager.add({
907 + type: "info",
908 + title: "Process already exited",
909 + description: "The process is not a child of the T3 Server. It might already have exited.",
910 + });
911 + return;
912 + }
913 +
914 + toastManager.add({
915 + type: "error",
916 + title: `Could not send ${signal}`,
917 + description: message ?? `Failed to send ${signal}.`,
918 + });
919 + return;
920 + }
921 + refreshProcesses();
922 + };
923
924 const processDiagnosticsError = processData ? Option.getOrNull(processData.error) : null;
925 const processResourceError = resourceData ? Option.getOrNull(resourceData.error) : null;