Skip to content

feat: 保存任务下拉框展开 - #342

Merged
MistEO merged 1 commit into
MistEO:mainfrom
zmdyy0318:feat/2026090801
Sep 10, 2026
Merged

feat: 保存任务下拉框展开#342
MistEO merged 1 commit into
MistEO:mainfrom
zmdyy0318:feat/2026090801

Conversation

@zmdyy0318

@zmdyy0318 zmdyy0318 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

避免选项越来越长杂乱
opus 5.0
image
close MaaEnd/MaaEnd#4964

Sourcery 总结

在配置保存、恢复和同步过程中,持久化并保留任务和选项的展开状态。

新功能:

  • 在保存的配置中持久化任务卡片展开状态和各选项的折叠状态。

错误修复:

  • 从其他客户端导入或同步配置时,保留本地任务和选项面板的可见状态。
Original summary in English

Summary by Sourcery

Persist and preserve task and option expansion states across configuration saves, restores, and synchronization.

New Features:

  • Persist task card expansion and per-option collapse states in saved configurations.

Bug Fixes:

  • Preserve local task and option panel visibility states when configurations are imported or synchronized from other clients.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

嗨——我发现了 1 个问题

AI Agent 提示词
请处理此次代码审查中的评论:

## 单独的评论

### 评论 1
<location path="src/stores/appStore.ts" line_range="1311" />
<code_context>
                 optionValues: t.optionValues,
-                expanded: prevExpandedByTask.get(t.id) ?? false,
+                expanded: prevExpandedByTask.get(t.id) ?? t.expanded ?? false,
+                collapsedOptions: prevCollapsedByTask.get(t.id) ?? t.collapsedOptions,
               };
             }
</code_context>
<issue_to_address>
**issue (broader_impact):** importConfig 会在内存中的任务值为 `undefined` 时使用持久化的 `t.collapsedOptions`,因此来自另一个客户端的配置更新可能会改变当前客户端可见的选项面板,尽管此代码声称本地状态具有优先级。

**触发条件:** 当前客户端存在一个从未显式切换过选项面板的任务,并且另一个客户端为同一任务保存了折叠状态时。

**建议修复:** 将任务是否已在本地初始化与其映射是否已定义分开进行跟踪,或者仅在冷启动期间使用持久化值,并在后续导入时保留现有的内存状态。
</issue_to_address>

Sourcery 对开源项目免费——如果您喜欢我们的审查结果,请考虑分享给他人 ✨
Original comment in English

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/stores/appStore.ts" line_range="1311" />
<code_context>
                 optionValues: t.optionValues,
-                expanded: prevExpandedByTask.get(t.id) ?? false,
+                expanded: prevExpandedByTask.get(t.id) ?? t.expanded ?? false,
+                collapsedOptions: prevCollapsedByTask.get(t.id) ?? t.collapsedOptions,
               };
             }
</code_context>
<issue_to_address>
**issue (broader_impact):** importConfig uses the persisted `t.collapsedOptions` whenever the in-memory task value is `undefined`, so a configuration update from another client can change the current client's visible option panels even though this code claims local state has priority.

**Triggers:** When the current client has an existing task that has never explicitly toggled an option panel, and another client saves a collapsed state for that same task.

**Suggested fix:** Track whether the task has been initialized locally separately from whether its map is defined, or use the persisted value only during cold startup and preserve the existing in-memory state for subsequent imports.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/stores/appStore.ts
@MistEO
MistEO merged commit 064fe22 into MistEO:main Sep 10, 2026
9 checks passed
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.

展开/收起设置项功能希望能记住设置

2 participants