Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webview-ui/src/components/chat/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const IconButton: React.FC<IconButtonProps> = ({
className,
)}
disabled={disabled}
onClick={!disabled ? onClick : undefined}
onClick={onClick}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks correct - removing the conditional onClick handler and relying on the native button's disabled attribute is the right approach. This simplifies the code and fixes the issue where buttons weren't responding to clicks.

A few observations for future consideration:

  1. Would it be worth adding tests for this component to prevent regression?
  2. I noticed there's another IconButton in webview-ui/src/components/common/IconButton.tsx - is this duplication intentional?
  3. Consider adding a comment explaining why conditional onClick isn't needed with the disabled attribute.

style={{ fontSize: 16.5, ...style }}
{...props}>
<span className={cn("codicon", iconClass, isLoading && "codicon-modifier-spin")} />
Expand Down
Loading