Skip to content

fix: setAIConfigs/setWebDAVConfigs 覆盖时保持 isActive 一致性#44

Merged
lostiv merged 1 commit into
mainfrom
fix/bug
May 15, 2026
Merged

fix: setAIConfigs/setWebDAVConfigs 覆盖时保持 isActive 一致性#44
lostiv merged 1 commit into
mainfrom
fix/bug

Conversation

@lostiv
Copy link
Copy Markdown
Owner

@lostiv lostiv commented May 15, 2026

autoSync 从后端拉取配置后调用 setWebDAVConfigs/setAIConfigs 直接替换数组, 未同步 isActive 与 activeWebDAVConfig/activeAIConfig 指针。 导致后端 stale 数据反向覆盖前端激活状态,备份保存时 isActive=false。

autoSync 从后端拉取配置后调用 setWebDAVConfigs/setAIConfigs 直接替换数组,
未同步 isActive 与 activeWebDAVConfig/activeAIConfig 指针。
导致后端 stale 数据反向覆盖前端激活状态,备份保存时 isActive=false。
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 57d3ce64-b650-4cc6-badc-7be27cc37f46

📥 Commits

Reviewing files that changed from the base of the PR and between ca0ceb0 and 8f11073.

📒 Files selected for processing (1)
  • src/store/useAppStore.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
src/store/**

⚙️ CodeRabbit configuration file

src/store/**: Zustand 状态管理。审查时请关注: 1. 持久化存储(IndexedDB)的数据结构和版本迁移 2. Selector 的细粒度订阅(避免不必要的重渲染) 3. 敏感数据是否被持久化到客户端 4. 状态更新的原子性和一致性

Files:

  • src/store/useAppStore.ts
🔇 Additional comments (1)
src/store/useAppStore.ts (1)

916-918: LGTM!

Also applies to: 937-939


📝 Walkthrough

Summary by CodeRabbit

发布说明

  • Bug 修复
    • 改进了 AI 和 WebDAV 配置批量更新时的激活状态同步机制,确保配置的激活状态正确反映当前选中配置。

概览

修改了 useAppStore 中的 setAIConfigssetWebDAVConfigs 方法,使其在批量设置配置时基于当前激活的配置 ID 重算每项的 isActive 标记,确保配置状态与激活配置保持同步。

变更

配置激活标记一致性同步

层级 / 文件 摘要
AI 配置激活标记同步
src/store/useAppStore.ts
setAIConfigs 改为使用状态更新函数,基于 state.activeAIConfig 对传入的 AI 配置映射并重算 isActive 标记后再写入状态。
WebDAV 配置激活标记同步
src/store/useAppStore.ts
setWebDAVConfigs 改为使用状态更新函数,基于 state.activeWebDAVConfig 对传入的 WebDAV 配置映射并重算 isActive 标记后再写入状态。

可能相关的 PR

  • lostiv/GithubStarsManager#42: 同样在 useAppStore 中强制 isActive 一致性,基于 activeAIConfig 对配置状态进行同步。
  • lostiv/GithubStarsManager#21: WebDAV 配置的 isActiveactiveWebDAVConfig 一致性修复,在同一文件的相关激活同步逻辑上直接相关。

建议标签

bug, frontend

审查工作量评估

🎯 2 (Simple) | ⏱️ ~8 分钟

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR标题遵循Conventional Commits格式(fix: 描述),清晰描述了修复的核心问题——在覆盖配置时保持isActive一致性。
Description check ✅ Passed PR描述详细阐述了问题背景、后果和修复意图,与代码变更直接相关。描述了autoSync拉取后端配置导致的isActive不一致问题。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bug
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/bug

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added bug Something isn't working frontend labels May 15, 2026
@lostiv lostiv merged commit 8f11073 into main May 15, 2026
1 check passed
@lostiv lostiv deleted the fix/bug branch May 15, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant