Repository navigation
Conversation
This branch has not been deployed
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.
改动类型
是否包含破坏性变更
改动说明
问题
添加与已有扫描目录存在嵌套关系的目录时,曲库中已入库的歌曲会被误删,且本地歌单中对应条目永久丢失(
playlist_tracks关联行被删除,重新扫描只恢复歌曲本身,不恢复歌单成员关系)。复现步骤:
C:\Music\Pop为扫描目录并扫描完成,将其中一首歌加入本地歌单C:\Music反向操作(先扫父目录、再添加子目录)同样触发。
原因
library:addScanDir(electron/main/ipc/library.ts)先将目录写入 store 再返回成功addScanDir(src/stores/library.ts)拿到成功结果后才做嵌套检测,检测到嵌套后调用library:removeScanDir撤销removeScanDir是「用户主动移除目录」的语义:除移除目录记录外还会通过deleteTracksByDir()删除该目录下全部曲目及歌单关联修复
将嵌套检测前移到主进程写入 store 之前:命中嵌套直接返回新增的
SCAN_DIR_NESTED错误码,目录不入库,撤销路径整体移除。渲染层只在成功时同步本地列表,UI 提示文案沿用原有「该目录与已添加目录嵌套,已自动跳过」。removeScanDir本身未改动:用户主动移除扫描目录时「连同曲目一起清理」的设计行为保持不变。测试情况
src/stores/library.spec.ts(vitest,2 用例通过):约束「添加扫描目录无论成功或被拒绝,均不触发removeScanDir」pnpm typecheck(node + web)、pnpm lint通过,改动文件已过 Prettier/与\分隔符,逻辑平台无关自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交