feat: 保存任务下拉框展开 - #342
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
嗨——我发现了 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>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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
避免选项越来越长杂乱

opus 5.0
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:
Bug Fixes: