The best way to control Claude Code, Codex and more from any computer or phone
perf(web): the environment selector compiles without manual memoization (#20575)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 22:05 UTC
2bb92ba474f311644137dcb1b6eac604c504bbee
1 file changed
+12
-16
apps/web/src/components/BranchToolbarEnvironmentSelector.tsx
+12
-16
@@ -3,7 +3,7 @@ import { ComposerContextLabel } from "./ComposerContextLabel";
3
import { Tooltip, TooltipTrigger, TooltipPopup } from "./ui/tooltip";
4
import type { EnvironmentId } from "@t3tools/contracts";
5
import { ScaleIcon } from "lucide-react";
6
-import { memo, useMemo } from "react";
6
+import { memo } from "react";
7
8
import type { EnvironmentOption } from "./BranchToolbar.logic";
9
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
@@ -35,22 +35,18 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
35
onEnvironmentChange,
36
}: BranchToolbarEnvironmentSelectorProps) {
37
const composerFloatingLayerProps = useComposerMenuProps();
38
- const activeEnvironment = useMemo(() => {
39
- return availableEnvironments.find((env) => env.environmentId === environmentId) ?? null;
40
- }, [availableEnvironments, environmentId]);
38
+ const activeEnvironment =
39
+ availableEnvironments.find((env) => env.environmentId === environmentId) ?? null;
40
42
- const environmentItems = useMemo(
43
- () => [
44
- ...(onAutoEnvironment
45
- ? [{ value: "auto", label: autoEnvironmentLabel ?? "Auto balance" }]
46
- : []),
47
- ...availableEnvironments.map((env) => ({
48
- value: env.environmentId,
49
- label: env.label,
50
- })),
51
- ],
52
- [availableEnvironments, autoEnvironmentLabel, onAutoEnvironment],
53
- );
41
+ const environmentItems = [
42
+ ...(onAutoEnvironment
43
+ ? [{ value: "auto", label: autoEnvironmentLabel ?? "Auto balance" }]
44
+ : []),
45
+ ...availableEnvironments.map((env) => ({
46
+ value: env.environmentId,
47
+ label: env.label,
48
+ })),
49
+ ];
50
51
// The static label carries the xs control's height (h-7 sm:h-6) as well as
52
// its padding: the composer context strip has no min-height of its own, and