fix: prevent double-toggle on tool/skill switches by stopping event propagation

The card onClick and Switch onChange both fired, canceling each other out.
Stop propagation on the Switch click so only one handler runs.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-02-24 22:02:35 +00:00
parent bbd9f0f2e6
commit 37d2caf5e9

View file

@ -115,7 +115,7 @@ const ToolCard: React.FC<{
<div className="text-sm font-medium text-gray-900">{tool.name}</div>
<div className="text-xs text-gray-500">{tool.description}</div>
</div>
<Switch checked={selected} onChange={onToggle} size="small" />
<Switch checked={selected} size="small" onClick={(_, e) => e.stopPropagation()} onChange={onToggle} />
</div>
);
@ -134,7 +134,7 @@ const SkillCard: React.FC<{
>
<div className="flex items-center justify-between">
<span className="text-sm font-medium text-gray-900">{skill.name}</span>
<Switch checked={selected} onChange={onToggle} size="small" />
<Switch checked={selected} size="small" onClick={(_, e) => e.stopPropagation()} onChange={onToggle} />
</div>
<div className="text-xs text-gray-500 mt-1">{skill.description}</div>
</div>