Skip to content

perf: batch preset skill toggles - #336

Open
vipinchan wants to merge 1 commit into
xingkongliang:mainfrom
vipinchan:perf/batch-preset-skill-toggle
Open

perf: batch preset skill toggles#336
vipinchan wants to merge 1 commit into
xingkongliang:mainfrom
vipinchan:perf/batch-preset-skill-toggle

Conversation

@vipinchan

Copy link
Copy Markdown

Summary

  • Add a batched preset membership toggle command so multi-select enable/disable uses one IPC call.
  • Apply all membership changes in a single database transaction.
  • Rewrite metadata once and refresh the tray once per batch instead of once per skill.
  • Keep behavior membership-only, matching the existing single-skill add/remove commands.

Why

The current multi-select preset action loops over selected skills and performs N sequential IPC calls. This change reduces that to one backend call and one metadata write while preserving semantics.

This addresses the batch operation portion of #295.

Test plan

  • npm run build
  • cargo test --manifest-path src-tauri/Cargo.toml
  • Manually enable and disable multiple selected skills in a preset and verify counts and membership refresh correctly.

Context

Split from #289 per maintainer feedback. The sync-time same-name dedup changes are intentionally not included.

- skill_store: 新增 batch_add_skills_to_scenario / batch_remove_skills_from_scenario,
  单事务内完成批量 INSERT/DELETE
- presets: 新增 batch_toggle_preset_skills Tauri 命令,metadata 写 1 次 + tray 刷 1 次
- lib.rs: 注册 batch_toggle_preset_skills
- tauri.ts: 新增 batchTogglePresetSkills API
- MySkills.tsx: handleBatchTogglePreset 从 N 次独立 IPC 改为 1 次批量调用
- N 选 30 时: 30 次 IPC + metadata 写入 + tray 重建 → 1 次
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant