TypeScript
perf(web): storage settings compile with the React Compiler (#20506)
Julius Marminged89076c6d8df
diff --git a/apps/web/reactCompiledFiles.ts b/apps/web/reactCompiledFiles.tsindex 46b63c98b98..ec6a37efc24 100644--- a/apps/web/reactCompiledFiles.ts+++ b/apps/web/reactCompiledFiles.ts@@ -81,4 +81,5 @@ export const REACT_COMPILED_FILES = ["apps/web/src/components/settings/SnapShotSetupDialog.tsx","apps/web/src/components/settings/NotificationSettings.tsx","apps/web/src/components/settings/ProviderSetupSection.tsx",+ "apps/web/src/components/settings/StorageSettings.tsx",] as const;diff --git a/apps/web/src/components/settings/StorageSettings.tsx b/apps/web/src/components/settings/StorageSettings.tsxindex 0c54d27755a..fa1783a56c5 100644--- a/apps/web/src/components/settings/StorageSettings.tsx+++ b/apps/web/src/components/settings/StorageSettings.tsx@@ -4,7 +4,7 @@ import type {WorktreeCleanupRules,} from "@t3tools/contracts";import { resolveWorktreeCleanup } from "@t3tools/shared/projectSettings";-import { useMemo, useRef, useState } from "react";+import { useRef, useState } from "react";import { useAtomValue } from "@effect/atom-react";import { Atom } from "effect/reactivity";import {@@ -259,32 +259,28 @@ function CleanupSection() {(environment) => environment.serverConfig?.environment.capabilities.storageCleanupRun === true,);const state = useAtomValue(- useMemo(- () =>- Atom.make((get) =>- connectedEnvironments.flatMap((environment) => {- if (environment.serverConfig?.environment.capabilities.storageCleanupRun !== true)- return [];- const query = get(- serverEnvironment.storageCleanupReport({- environmentId: environment.environmentId,- input: {},- }),- );- return [- {- environmentId: environment.environmentId,- allowed: get(- serverEnvironment.runStorageCleanup.permissionAtom(environment.environmentId),- ),- report: query._tag === "Success" ? query.value : null,- loading: query.waiting,- failed: query._tag === "Failure",- },- ];+ Atom.make((get) =>+ connectedEnvironments.flatMap((environment) => {+ if (environment.serverConfig?.environment.capabilities.storageCleanupRun !== true)+ return [];+ const query = get(+ serverEnvironment.storageCleanupReport({+ environmentId: environment.environmentId,+ input: {},}),- ),- [connectedEnvironments],+ );+ return [+ {+ environmentId: environment.environmentId,+ allowed: get(+ serverEnvironment.runStorageCleanup.permissionAtom(environment.environmentId),+ ),+ report: query._tag === "Success" ? query.value : null,+ loading: query.waiting,+ failed: query._tag === "Failure",+ },+ ];+ }),),);const hasRules = supported.some((environment) => {@@ -329,36 +325,30 @@ function CleanupSection() {const deleteNow = async () => {if (pending) return;setPending(true);- try {- await Promise.all(- supported- .filter((environment) =>- state.some(- (entry) => entry.environmentId === environment.environmentId && entry.allowed,- ),- )- .map(async (environment) => {- const result = await run({ environmentId: environment.environmentId, input: {} });- if (result._tag === "Success") {- const failures = result.value.entries.filter((entry) => entry.outcome === "failed");- if (failures.length > 0)- toastManager.add({- type: "error",- title: `Cleanup failed on ${environment.label}`,- description: failures[0]!.reason,- });- } else if (!isAtomCommandInterrupted(result)) {+ await Promise.all(+ supported+ .filter((environment) =>+ state.some((entry) => entry.environmentId === environment.environmentId && entry.allowed),+ )+ .map(async (environment) => {+ const result = await run({ environmentId: environment.environmentId, input: {} });+ if (result._tag === "Success") {+ const failures = result.value.entries.filter((entry) => entry.outcome === "failed");+ if (failures.length > 0)toastManager.add({type: "error",- title: `Could not run cleanup on ${environment.label}`,- description: String(squashAtomCommandFailure(result)),+ title: `Cleanup failed on ${environment.label}`,+ description: failures[0]!.reason,});- }- }),- );- } finally {- setPending(false);- }+ } else if (!isAtomCommandInterrupted(result)) {+ toastManager.add({+ type: "error",+ title: `Could not run cleanup on ${environment.label}`,+ description: String(squashAtomCommandFailure(result)),+ });+ }+ }),+ ).finally(() => setPending(false));};return (<SettingsSection id="storage-cleanup" title="Cleanup" variant="plain">