Skip to content

Bug: Skills Import Count Multiplied When Button Clicked Multiple Times #2139

Description

@newbee1023

Self Checks / 自检

CC Switch Version / 版本号

v3.13.0

Operating System / 操作系统

Windows

Related App / 涉及应用

Claude Code

Steps to Reproduce / 重现步骤

Description

When opening the Skills management panel and clicking the "Import Existing" button, if the user quickly clicks the "Confirm" button twice (or multiple times when the interface lags due to importing many
skills), the displayed count of "Installed Claude:" becomes incorrect - it shows a multiple of the actual count based on the number of clicks.

Root Cause

  1. The import confirmation button in ImportSkillsDialog (line 841) is not disabled during mutation execution, allowing users to click multiple times
  2. The cache update in useImportSkillsFromApps hook (lines 207-215) directly appends to the array without deduplication logic, causing the same skills to be added multiple times to the cache

Steps to Reproduce

  1. Open the Skills management panel
  2. Click "Import Existing" button
  3. In the import dialog, quickly click the "Import" button multiple times (or click repeatedly when importing many skills causes UI lag)
  4. After import completes, observe the "Installed Claude:" count

Expected Behavior / 期望行为

Expected Behavior

  • Import button should be disabled during the import process
  • Skills count should display the correct number, not multiplied by click count

Actual Behavior / 实际行为

Actual Behavior

  • Button remains clickable during import
  • Count shows a multiplied number (e.g., if clicked 3 times and imported 5 skills, count shows 15)

Affected Files

  • src/components/skills/UnifiedSkillsPanel.tsx - ImportSkillsDialog component
  • src/hooks/useSkills.ts - useImportSkillsFromApps hook

Additional Context / 补充信息

Suggested Fix

  1. Pass importMutation.isPending state to ImportSkillsDialog and disable the button when importing
  2. Add deduplication logic to the cache update in useImportSkillsFromApps.onSuccess

Environment

  • CC Switch version: 3.13.0
  • Platform: All (Windows/macOS/Linux)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions