Closed
Conversation
修复折叠逻辑,当用户折叠一个包含多个子目录的父节点时,现在会同时清除该目录及其所有展开的后代路径。这防止了孤立的子路径残留在 localStorage 中,导致用户在切换仓库回来后看到子节点显示为"展开"状态但内容为空的现象。 变更: - 简化折叠逻辑:移除复杂的 collectCompactedPaths 递归函数 - 改为直接清除目标路径及所有以其开头的后代路径 - 此行为对压缩链(single-child directories)仍然有效,因为它们本质上就是后代关系 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
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.
问题描述
当用户在目录树中展开多层文件夹,然后收起父节点或某个祖先节点之后,切换到目录树的别的仓库,再次切换回来时,目录树的展开状态会丢失。
具体表现:
根因分析
折叠逻辑(
collectCompactedPaths)仅处理"压缩链"(只有单个子目录的连续路径),当父节点有多个子目录时:切换仓库回来时(
restoreChildren):updateTreeWithChain在树结构中找不到这些路径,静默失败修复方案
简化折叠逻辑:直接清除目标路径及其所有展开的后代路径。
行为对比
测试步骤
src/renderer/components/files/)/components)🤖 Generated with Claude Code