Skip to content

Commit 57f0c49

Browse files
committed
Remove redundant useCallbacks
1 parent 5337baa commit 57f0c49

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

client/src/components/RootsTab.tsx

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Input } from "@/components/ui/input";
44
import { TabsContent } from "@/components/ui/tabs";
55
import { Root } from "@modelcontextprotocol/sdk/types.js";
66
import { Plus, Minus, Save } from "lucide-react";
7-
import { useCallback } from "react";
87

98
const RootsTab = ({
109
roots,
@@ -15,31 +14,25 @@ const RootsTab = ({
1514
setRoots: React.Dispatch<React.SetStateAction<Root[]>>;
1615
onRootsChange: () => void;
1716
}) => {
18-
const addRoot = useCallback(() => {
17+
const addRoot = () => {
1918
setRoots((currentRoots) => [...currentRoots, { uri: "file://", name: "" }]);
20-
}, [setRoots]);
19+
};
2120

22-
const removeRoot = useCallback(
23-
(index: number) => {
24-
setRoots((currentRoots) => currentRoots.filter((_, i) => i !== index));
25-
},
26-
[setRoots],
27-
);
21+
const removeRoot = (index: number) => {
22+
setRoots((currentRoots) => currentRoots.filter((_, i) => i !== index));
23+
};
2824

29-
const updateRoot = useCallback(
30-
(index: number, field: keyof Root, value: string) => {
31-
setRoots((currentRoots) =>
32-
currentRoots.map((root, i) =>
33-
i === index ? { ...root, [field]: value } : root,
34-
),
35-
);
36-
},
37-
[setRoots],
38-
);
25+
const updateRoot = (index: number, field: keyof Root, value: string) => {
26+
setRoots((currentRoots) =>
27+
currentRoots.map((root, i) =>
28+
i === index ? { ...root, [field]: value } : root,
29+
),
30+
);
31+
};
3932

40-
const handleSave = useCallback(() => {
33+
const handleSave = () => {
4134
onRootsChange();
42-
}, [onRootsChange]);
35+
};
4336

4437
return (
4538
<TabsContent value="roots" className="space-y-4">

0 commit comments

Comments
 (0)