Skip to content

Commit c837e3f

Browse files
perf(web): storage settings compile with the React Compiler
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 63c43d6 commit c837e3f

2 files changed

Lines changed: 44 additions & 53 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,5 @@ export const REACT_COMPILED_FILES = [
8181
"apps/web/src/components/settings/SnapShotSetupDialog.tsx",
8282
"apps/web/src/components/settings/NotificationSettings.tsx",
8383
"apps/web/src/components/settings/ProviderSetupSection.tsx",
84+
"apps/web/src/components/settings/StorageSettings.tsx",
8485
] as const;

‎apps/web/src/components/settings/StorageSettings.tsx‎

Lines changed: 43 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
WorktreeCleanupRules,
55
} from "@t3tools/contracts";
66
import { resolveWorktreeCleanup } from "@t3tools/shared/projectSettings";
7-
import { useMemo, useRef, useState } from "react";
7+
import { useRef, useState } from "react";
88
import { useAtomValue } from "@effect/atom-react";
99
import { Atom } from "effect/reactivity";
1010
import {
@@ -259,32 +259,28 @@ function CleanupSection() {
259259
(environment) => environment.serverConfig?.environment.capabilities.storageCleanupRun === true,
260260
);
261261
const state = useAtomValue(
262-
useMemo(
263-
() =>
264-
Atom.make((get) =>
265-
connectedEnvironments.flatMap((environment) => {
266-
if (environment.serverConfig?.environment.capabilities.storageCleanupRun !== true)
267-
return [];
268-
const query = get(
269-
serverEnvironment.storageCleanupReport({
270-
environmentId: environment.environmentId,
271-
input: {},
272-
}),
273-
);
274-
return [
275-
{
276-
environmentId: environment.environmentId,
277-
allowed: get(
278-
serverEnvironment.runStorageCleanup.permissionAtom(environment.environmentId),
279-
),
280-
report: query._tag === "Success" ? query.value : null,
281-
loading: query.waiting,
282-
failed: query._tag === "Failure",
283-
},
284-
];
262+
Atom.make((get) =>
263+
connectedEnvironments.flatMap((environment) => {
264+
if (environment.serverConfig?.environment.capabilities.storageCleanupRun !== true)
265+
return [];
266+
const query = get(
267+
serverEnvironment.storageCleanupReport({
268+
environmentId: environment.environmentId,
269+
input: {},
285270
}),
286-
),
287-
[connectedEnvironments],
271+
);
272+
return [
273+
{
274+
environmentId: environment.environmentId,
275+
allowed: get(
276+
serverEnvironment.runStorageCleanup.permissionAtom(environment.environmentId),
277+
),
278+
report: query._tag === "Success" ? query.value : null,
279+
loading: query.waiting,
280+
failed: query._tag === "Failure",
281+
},
282+
];
283+
}),
288284
),
289285
);
290286
const hasRules = supported.some((environment) => {
@@ -329,36 +325,30 @@ function CleanupSection() {
329325
const deleteNow = async () => {
330326
if (pending) return;
331327
setPending(true);
332-
try {
333-
await Promise.all(
334-
supported
335-
.filter((environment) =>
336-
state.some(
337-
(entry) => entry.environmentId === environment.environmentId && entry.allowed,
338-
),
339-
)
340-
.map(async (environment) => {
341-
const result = await run({ environmentId: environment.environmentId, input: {} });
342-
if (result._tag === "Success") {
343-
const failures = result.value.entries.filter((entry) => entry.outcome === "failed");
344-
if (failures.length > 0)
345-
toastManager.add({
346-
type: "error",
347-
title: `Cleanup failed on ${environment.label}`,
348-
description: failures[0]!.reason,
349-
});
350-
} else if (!isAtomCommandInterrupted(result)) {
328+
await Promise.all(
329+
supported
330+
.filter((environment) =>
331+
state.some((entry) => entry.environmentId === environment.environmentId && entry.allowed),
332+
)
333+
.map(async (environment) => {
334+
const result = await run({ environmentId: environment.environmentId, input: {} });
335+
if (result._tag === "Success") {
336+
const failures = result.value.entries.filter((entry) => entry.outcome === "failed");
337+
if (failures.length > 0)
351338
toastManager.add({
352339
type: "error",
353-
title: `Could not run cleanup on ${environment.label}`,
354-
description: String(squashAtomCommandFailure(result)),
340+
title: `Cleanup failed on ${environment.label}`,
341+
description: failures[0]!.reason,
355342
});
356-
}
357-
}),
358-
);
359-
} finally {
360-
setPending(false);
361-
}
343+
} else if (!isAtomCommandInterrupted(result)) {
344+
toastManager.add({
345+
type: "error",
346+
title: `Could not run cleanup on ${environment.label}`,
347+
description: String(squashAtomCommandFailure(result)),
348+
});
349+
}
350+
}),
351+
).finally(() => setPending(false));
362352
};
363353
return (
364354
<SettingsSection id="storage-cleanup" title="Cleanup" variant="plain">

0 commit comments

Comments
 (0)