Skip to content

Commit a852382

Browse files
perf(web): the provider updates action compiles with the React Compiler
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ca61f07 commit a852382

2 files changed

Lines changed: 18 additions & 23 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ export const REACT_COMPILED_FILES = [
6060
"apps/web/src/components/files/useDirectoryEntries.ts",
6161
"apps/web/src/components/files/FileBrowserPanel.tsx",
6262
"apps/web/src/components/sidebar/SidebarUpdatePill.tsx",
63+
"apps/web/src/components/ProviderUpdatesAction.tsx",
6364
] as const;

‎apps/web/src/components/ProviderUpdatesAction.tsx‎

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { PROVIDER_DISPLAY_NAMES } from "@t3tools/contracts";
2-
import { useMemo, useRef, useState } from "react";
2+
import { settlePromise } from "@t3tools/client-runtime/state/runtime";
3+
import { useRef, useState } from "react";
34

45
import { useEnvironments } from "~/state/environments";
56
import { serverEnvironment } from "~/state/server";
@@ -19,22 +20,18 @@ export function useProviderUpdates() {
1920
const updateProvider = useAtomCommand(serverEnvironment.updateProvider, {
2021
reportFailure: false,
2122
});
22-
const machines = useMemo(
23-
() =>
24-
environments.flatMap((environment) => {
25-
const providers = environment.serverConfig?.providers ?? [];
26-
if (environment.connection.phase !== "connected") {
27-
return [];
28-
}
29-
const candidates = collectProviderUpdateCandidates(providers).filter((candidate) =>
30-
canOneClickUpdateProviderCandidate(candidate, providers),
31-
);
32-
return candidates.length > 0
33-
? [{ environmentId: environment.environmentId, label: environment.label, candidates }]
34-
: [];
35-
}),
36-
[environments],
37-
);
23+
const machines = environments.flatMap((environment) => {
24+
const providers = environment.serverConfig?.providers ?? [];
25+
if (environment.connection.phase !== "connected") {
26+
return [];
27+
}
28+
const candidates = collectProviderUpdateCandidates(providers).filter((candidate) =>
29+
canOneClickUpdateProviderCandidate(candidate, providers),
30+
);
31+
return candidates.length > 0
32+
? [{ environmentId: environment.environmentId, label: environment.label, candidates }]
33+
: [];
34+
});
3835

3936
const updateAll = async ({ quiet = false }: { readonly quiet?: boolean } = {}) => {
4037
const runs = await Promise.all(
@@ -78,12 +75,9 @@ export function ProviderUpdatesAction() {
7875
if (pending.current) return;
7976
pending.current = true;
8077
setIsPending(true);
81-
try {
82-
await updateAll();
83-
} finally {
84-
pending.current = false;
85-
setIsPending(false);
86-
}
78+
await settlePromise(() => updateAll());
79+
pending.current = false;
80+
setIsPending(false);
8781
};
8882

8983
return (

0 commit comments

Comments
 (0)