From 753783ddd01c1233f6331b7c183605b0aa1edb36 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Wed, 18 Mar 2026 20:14:54 +0800 Subject: [PATCH] fix: handle nested folder click with endsWith match --- src/components/ApiDocViewer.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/ApiDocViewer.tsx b/src/components/ApiDocViewer.tsx index fd0b537..073df2d 100644 --- a/src/components/ApiDocViewer.tsx +++ b/src/components/ApiDocViewer.tsx @@ -106,8 +106,9 @@ export const ApiDocViewer = ({ onDocsPathChange, showAddModal, onCloseAddModal } }, [externalDocs]) const handleFolderClick = useCallback((folderPath: string) => { - const sameNamePath = `${folderPath}/${folderPath}.md` - const sameNameDoc = externalDocs.find(d => d.relativePath === sameNamePath) + const sameNameDoc = externalDocs.find(d => + d.relativePath.endsWith(`/${folderPath}.md`) + ) if (sameNameDoc) { setSelectedPath(sameNameDoc.relativePath.replace(/^api\//, ''))