fix(frontend): 修复文件树点击切换竞态

This commit is contained in:
2026-08-30 10:29:08 +08:00
parent 99a0595dbc
commit 1564df434d
4 changed files with 104 additions and 3 deletions
@@ -16,7 +16,10 @@ onMounted(() => {
}
if (!workspaceStore.activeFilePath && workspaceStore.fileTree.length === 0) {
void editorStore.loadFile('/欢迎使用知笔知己.md').then(() => {
workspaceStore.openFile('/欢迎使用知笔知己.md')
// 默认文件加载期间用户可能已经点击了其他文件,不能覆盖用户的选择。
if (!workspaceStore.activeFilePath && editorStore.currentFilePath === '/欢迎使用知笔知己.md') {
workspaceStore.openFile('/欢迎使用知笔知己.md')
}
})
}
})