Skip to content

Commit 510f607

Browse files
perf(web): useAtomQueryRunner compiles without manual memoization
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7111501 commit 510f607

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

‎apps/web/reactCompiledFiles.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,5 @@ export const REACT_COMPILED_FILES = [
9696
"apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx",
9797
"apps/web/src/components/ThreadTerminalDrawer.tsx",
9898
"apps/web/src/components/settings/SettingsPanels.tsx",
99+
"apps/web/src/state/use-atom-query-runner.ts",
99100
] as const;

‎apps/web/src/state/use-atom-query-runner.ts‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
type AtomCommandResult,
66
} from "@t3tools/client-runtime/state/runtime";
77
import { AsyncResult, type Atom } from "effect/reactivity";
8-
import { useCallback, useContext } from "react";
8+
import { useContext } from "react";
99

1010
export function useAtomQueryRunner<T, A, E>(
1111
family: (target: T) => Atom.Atom<AsyncResult.AsyncResult<A, E>>,
@@ -17,16 +17,13 @@ export function useAtomQueryRunner<T, A, E>(
1717
const reportDefect = typeof options === "string" ? true : (options?.reportDefect ?? true);
1818
const refresh = typeof options === "string" ? false : (options?.refresh ?? false);
1919

20-
return useCallback(
21-
(target: T) => {
22-
const atom = family(target);
23-
return executeAtomQuery(registry, atom, {
24-
label: explicitLabel ?? atom.label?.[0] ?? "atom query",
25-
reportFailure,
26-
reportDefect,
27-
refresh,
28-
});
29-
},
30-
[explicitLabel, family, registry, refresh, reportDefect, reportFailure],
31-
);
20+
return (target: T) => {
21+
const atom = family(target);
22+
return executeAtomQuery(registry, atom, {
23+
label: explicitLabel ?? atom.label?.[0] ?? "atom query",
24+
reportFailure,
25+
reportDefect,
26+
refresh,
27+
});
28+
};
3229
}

0 commit comments

Comments
 (0)