fix: filter depth >= 3 from tree display

This commit is contained in:
2026-03-18 20:27:40 +08:00
parent 66c3f8596d
commit 845c91f676

View File

@@ -72,13 +72,7 @@ export const ApiDocViewer = ({ onDocsPathChange, showAddModal, onCloseAddModal }
setExternalDocs(docs)
const fileList = docs
.filter(doc => {
const parts = doc.relativePath.split('/')
if (parts.length < 2) return true
const filename = parts[parts.length - 1].replace(/\.md$/, '')
const parentFolder = parts[parts.length - 2]
return filename !== parentFolder
})
.filter(doc => doc.relativePath.split('/').length < 3)
.map(d => d.relativePath)
const tree = buildFileTree(fileList, '/')
setFileTree(tree)