Skip to content

Commit

Permalink
do not duplicate tools on render (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorpela authored Apr 5, 2024
1 parent 123642f commit 9dda0f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/components/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,9 @@ export function Config(props: {
if (!values) return;
if (!values.configurable) return;
const tools = (values.configurable["type==agent/tools"] as Tool[]) ?? [];
setSelectedTools((oldTools) => [...oldTools, ...tools]);
setSelectedTools((oldTools) =>
oldTools !== tools ? [...tools] : oldTools,
);
}, [values]);

const handleAddTool = (tool: Tool) => {
Expand Down

0 comments on commit 9dda0f5

Please sign in to comment.