Skip to content
TypeScript

perf(web): useAtomCommand compiles without manual memoization (#20568)

Julius Marminge3ff9a734584b
diff --git a/apps/web/src/state/use-atom-command.ts b/apps/web/src/state/use-atom-command.ts
index 37ce280e9f4..b969091e7fa 100644
--- a/apps/web/src/state/use-atom-command.ts
+++ b/apps/web/src/state/use-atom-command.ts
@@ -5,7 +5,7 @@ import {
type AtomCommandResult,
runAtomCommand,
} from "@t3tools/client-runtime/state/runtime";
-import { useCallback, useContext } from "react";
+import { useContext } from "react";
export function useAtomCommand<A, E, W>(
command: AtomCommand<W, A, E>,
@@ -16,8 +16,6 @@ export function useAtomCommand<A, E, W>(
const reportFailure = typeof options === "string" ? true : (options?.reportFailure ?? true);
const reportDefect = typeof options === "string" ? true : (options?.reportDefect ?? true);
- return useCallback(
- (value: W) => runAtomCommand(registry, command, value, { label, reportFailure, reportDefect }),
- [command, label, registry, reportDefect, reportFailure],
- );
+ return (value: W) =>
+ runAtomCommand(registry, command, value, { label, reportFailure, reportDefect });
}