@devries-cameron20 / t3code Mirror · read-only / commits / 82a99f731e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 06:45 UTC

perf(web): the pull request state hooks compile without manual memoization (#20710)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 21:47 UTC 82a99f731e7876ef8c6830c108a096f946e85603
1 file changed +15 -21
apps/web/src/state/pullRequests.ts
+15 -21
@@ -21,7 +21,7 @@ import {
21 } from "@t3tools/shared/threadPullRequests";
22 import * as Option from "effect/Option";
23 import { AsyncResult, Atom } from "effect/reactivity";
24 -import { useCallback, useLayoutEffect, useMemo } from "react";
24 +import { useLayoutEffect } from "react";
25
26 import { connectionAtomRuntime } from "../connection/runtime";
27 import { appAtomRegistry } from "../rpc/atomRegistry";
@@ -288,16 +288,13 @@ function createMergedEnvironmentQuery<Input, A>(
288 return function useMergedQuery(targets: ReadonlyArray<EnvironmentQueryTarget<Input>>) {
289 const key = JSON.stringify(targets);
290 const view = useAtomValue(targets.length === 0 ? empty : family(key));
291 - const refresh = useCallback(
292 - (override?: ReadonlyArray<EnvironmentQueryTarget<Input>>) => {
293 - const refreshTargets =
294 - override ?? (JSON.parse(key) as ReadonlyArray<EnvironmentQueryTarget<Input>>);
295 - for (const atom of new Set(refreshTargets.map(atomFor))) {
296 - appAtomRegistry.refresh(atom);
297 - }
298 - },
299 - [key],
300 - );
291 + const refresh = (override?: ReadonlyArray<EnvironmentQueryTarget<Input>>) => {
292 + const refreshTargets =
293 + override ?? (JSON.parse(key) as ReadonlyArray<EnvironmentQueryTarget<Input>>);
294 + for (const atom of new Set(refreshTargets.map(atomFor))) {
295 + appAtomRegistry.refresh(atom);
296 + }
297 + };
298 return { ...view, refresh };
299 };
300 }
@@ -359,7 +356,7 @@ export function usePullRequestList(
356 }
357 }
358 }, [query.observations]);
362 - const data = useMemo(() => mergePullRequestLists(query.values), [query.values]);
359 + const data = mergePullRequestLists(query.values);
360 return { data, error: query.error, isPending: query.isPending, refresh: query.refresh };
361 }
362
@@ -373,14 +370,11 @@ export function usePullRequestListStats(
370 ) => void;
371 } {
372 const query = usePullRequestStatsQuery(targets);
376 - const stats = useMemo(
377 - () =>
378 - query.values.length === 0
379 - ? null
380 - : query.values.flatMap(([environmentId, result]) =>
381 - result.stats.map((stat) => ({ ...stat, environmentId })),
382 - ),
383 - [query.values],
384 - );
373 + const stats =
374 + query.values.length === 0
375 + ? null
376 + : query.values.flatMap(([environmentId, result]) =>
377 + result.stats.map((stat) => ({ ...stat, environmentId })),
378 + );
379 return { stats, isPending: query.isPending, refresh: query.refresh };
380 }