From 8c39b15c55fc396f0bae47a3ccae6db40e04dadc Mon Sep 17 00:00:00 2001 From: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> Date: Thu, 22 Jan 2026 15:00:05 -0500 Subject: [PATCH] fix: Update example.js to address react console docs bug. --- .../documentation-framework/components/example/example.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/documentation-framework/components/example/example.js b/packages/documentation-framework/components/example/example.js index faea37a6d4..ab00910be7 100644 --- a/packages/documentation-framework/components/example/example.js +++ b/packages/documentation-framework/components/example/example.js @@ -224,8 +224,9 @@ export const Example = ({ const cleanPathname = loc.pathname.replace(/\/$/, ''); const sourcePath = `/${source}`; - // Check if the source is already in the pathname to avoid duplication - if (cleanPathname.includes(sourcePath)) { + // Check if the source is already at the end of the pathname to avoid duplication + // Using endsWith instead of includes to prevent false positives (e.g., /react-console matching /react) + if (cleanPathname.endsWith(sourcePath)) { return `${cleanPathname}/${slugger(title)}`; } else { return `${cleanPathname}${sourcePath}/${slugger(title)}`;