Skip to content
TypeScript

perf(web): the archived threads hook compiles without manual memoization (#20624)

Julius Marmingee36d0b2d1f3c
diff --git a/apps/web/src/lib/archivedThreadsState.ts b/apps/web/src/lib/archivedThreadsState.ts
index 2d52383c02c..a84e072255b 100644
--- a/apps/web/src/lib/archivedThreadsState.ts
+++ b/apps/web/src/lib/archivedThreadsState.ts
@@ -5,7 +5,6 @@ import {
makeArchivedThreadsEnvironmentKey,
} from "@t3tools/client-runtime/state/threads";
import type { EnvironmentId } from "@t3tools/contracts";
-import { useCallback, useMemo } from "react";
import { orchestrationEnvironment } from "../state/orchestration";
import { appAtomRegistry } from "../rpc/atomRegistry";
@@ -32,16 +31,13 @@ export function useArchivedThreadSnapshots(environmentIds: ReadonlyArray<Environ
readonly isLoading: boolean;
readonly refresh: () => void;
} {
- const environmentKey = useMemo(
- () => makeArchivedThreadsEnvironmentKey(environmentIds),
- [environmentIds],
- );
+ const environmentKey = makeArchivedThreadsEnvironmentKey(environmentIds);
const result = useAtomValue(archivedSnapshotsAtom(environmentKey));
- const refresh = useCallback(() => {
+ const refresh = () => {
for (const environmentId of environmentIds) {
appAtomRegistry.refresh(archivedSnapshotAtom(environmentId));
}
- }, [environmentIds]);
+ };
return {
...result,