From d979313212ffa9a740d7c0e8de51bd3d94bbb931 Mon Sep 17 00:00:00 2001 From: Zach Shilton <4624598+zchsh@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:50:24 -0500 Subject: [PATCH] fix isActive bug in OpenAPI docs view v2 (#2632) --- src/views/open-api-docs-view-v2/server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/open-api-docs-view-v2/server.ts b/src/views/open-api-docs-view-v2/server.ts index 7b2ebe71d3..7e6a12fb76 100644 --- a/src/views/open-api-docs-view-v2/server.ts +++ b/src/views/open-api-docs-view-v2/server.ts @@ -234,6 +234,9 @@ export async function generateStaticProps({ notFound: true, } } + const targetOperationSlug = targetOperation + ? slugifyOperationId(targetOperation.operationId) + : null /** * Build links for the sidebar. @@ -260,7 +263,7 @@ export async function generateStaticProps({ return { text: wordBreakCamelCase(operationId), href: operationUrl, - isActive: operationSlug === operationId, + isActive: operationSlug === targetOperationSlug, } }), }))