Skip to content
TypeScript

perf(web): the worktree base branch picker compiles without manual memoization (#20634)

Julius Marmingef99d12b5e577
diff --git a/apps/web/src/components/WorktreeBaseBranchPicker.tsx b/apps/web/src/components/WorktreeBaseBranchPicker.tsx
index d78dc73e6ca..0ad0f7005e3 100644
--- a/apps/web/src/components/WorktreeBaseBranchPicker.tsx
+++ b/apps/web/src/components/WorktreeBaseBranchPicker.tsx
@@ -1,6 +1,6 @@
import type { EnvironmentId } from "@t3tools/contracts";
import { ChevronDownIcon, GitBranchIcon } from "lucide-react";
-import { useDeferredValue, useMemo, useState } from "react";
+import { useDeferredValue, useState } from "react";
import { usePaginatedBranches } from "../state/queries";
import { useEnvironmentQuery } from "../state/query";
@@ -56,10 +56,7 @@ export function WorktreeBaseBranchPicker({
resolvedActiveBranchIsRemote: selectedRef ? selectedRef.isRemote === true : null,
startFromOrigin,
});
- const branchByName = useMemo(
- () => new Map(branches.refs.map((branch) => [branch.name, branch])),
- [branches.refs],
- );
+ const branchByName = new Map(branches.refs.map((branch) => [branch.name, branch]));
const items = [...branchByName.keys()];
const hasNextPage = branches.data?.nextCursor != null;
const statusText =