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 code block language picker compiles without manual memoization (#20663)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 21:55 UTC
15a8774dbad09c63f7517e63279cfa9197afe1e7
1 file changed
+10
-15
apps/web/src/components/chat/ComposerCodeBlockLanguagePicker.tsx
+10
-15
@@ -1,5 +1,5 @@
1
import { CheckIcon, ChevronDownIcon } from "lucide-react";
2
-import { useMemo, useState } from "react";
2
+import { useState } from "react";
3
4
import {
5
CODE_BLOCK_LANGUAGES,
@@ -36,20 +36,15 @@ export function ComposerCodeBlockLanguagePicker(props: {
36
}) {
37
const [query, setQuery] = useState("");
38
const current = codeLanguageEntry(props.language)?.id ?? props.language;
39
- const items = useMemo<CodeBlockLanguage[]>(
40
- () =>
41
- CODE_BLOCK_LANGUAGES.some((entry) => entry.id === current)
42
- ? [...CODE_BLOCK_LANGUAGES]
43
- : [{ id: current, label: current }, ...CODE_BLOCK_LANGUAGES],
44
- [current],
45
- );
46
- const filteredItems = useMemo(() => {
47
- const needle = query.trim().toLowerCase();
48
- if (!needle) return items;
49
- return items.filter(
50
- (entry) => entry.label.toLowerCase().includes(needle) || entry.id.includes(needle),
51
- );
52
- }, [items, query]);
39
+ const items: CodeBlockLanguage[] = CODE_BLOCK_LANGUAGES.some((entry) => entry.id === current)
40
+ ? [...CODE_BLOCK_LANGUAGES]
41
+ : [{ id: current, label: current }, ...CODE_BLOCK_LANGUAGES];
42
+ const needle = query.trim().toLowerCase();
43
+ const filteredItems = needle
44
+ ? items.filter(
45
+ (entry) => entry.label.toLowerCase().includes(needle) || entry.id.includes(needle),
46
+ )
47
+ : items;
48
const selected = items.find((entry) => entry.id === current) ?? null;
49
50
return (