Skip to content

Commit 5cce260

Browse files
perf(web): useOrchestrationCommand compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a702563 commit 5cce260

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

‎apps/web/src/state/use-orchestration-command.ts‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
} from "@t3tools/contracts";
1111
import * as Cause from "effect/Cause";
1212
import { AsyncResult } from "effect/reactivity";
13-
import { useCallback } from "react";
1413

1514
import { readEnvironmentScope } from "./session";
1615
import { useAtomCommand } from "./use-atom-command";
@@ -23,20 +22,17 @@ export function useOrchestrationCommand<W extends { readonly environmentId: Envi
2322
options?: string | AtomCommandOptions,
2423
): (value: W) => Promise<AtomCommandResult<A, E | EnvironmentAuthorizationError>> {
2524
const run = useAtomCommand(command, options);
26-
return useCallback(
27-
async (value: W): Promise<AtomCommandResult<A, E | EnvironmentAuthorizationError>> => {
28-
if (!readEnvironmentScope(value.environmentId, AuthOrchestrationOperateScope)) {
29-
return AsyncResult.failure(
30-
Cause.fail(
31-
new EnvironmentAuthorizationError({
32-
requiredScope: AuthOrchestrationOperateScope,
33-
message: ORCHESTRATION_OPERATE_DENIED_MESSAGE,
34-
}),
35-
),
36-
);
37-
}
38-
return run(value);
39-
},
40-
[run],
41-
);
25+
return async (value: W): Promise<AtomCommandResult<A, E | EnvironmentAuthorizationError>> => {
26+
if (!readEnvironmentScope(value.environmentId, AuthOrchestrationOperateScope)) {
27+
return AsyncResult.failure(
28+
Cause.fail(
29+
new EnvironmentAuthorizationError({
30+
requiredScope: AuthOrchestrationOperateScope,
31+
message: ORCHESTRATION_OPERATE_DENIED_MESSAGE,
32+
}),
33+
),
34+
);
35+
}
36+
return run(value);
37+
};
4238
}

0 commit comments

Comments
 (0)