From b84b627e8c3d9e4fefca2faeb1891c1864becbf0 Mon Sep 17 00:00:00 2001 From: Grace Park Date: Tue, 6 Sep 2022 09:14:25 -0700 Subject: [PATCH] Fix bug for ghec version of experimental pages (#30494) --- components/context/PlaygroundContext.tsx | 5 +++-- components/playground/CodeLanguagePicker.tsx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/context/PlaygroundContext.tsx b/components/context/PlaygroundContext.tsx index b7f5245cfd..3047070894 100644 --- a/components/context/PlaygroundContext.tsx +++ b/components/context/PlaygroundContext.tsx @@ -59,8 +59,9 @@ export const PlaygroundContextProvider = (props: { children: React.ReactNode }) const router = useRouter() const [activeSectionIndex, setActiveSectionIndex] = useState(0) const [scrollToSection, setScrollToSection] = useState() - const path = router.asPath.split('?')[0].split('#')[0] - + const path = router.asPath.includes('@latest') + ? router.asPath.split('?')[0].split('#')[0].split('@latest')[1] + : router.asPath.split('?')[0].split('#')[0] const relevantArticles = articles.filter(({ slug }) => slug === path) const { langId } = router.query diff --git a/components/playground/CodeLanguagePicker.tsx b/components/playground/CodeLanguagePicker.tsx index f7df48ed4c..83389ed99f 100644 --- a/components/playground/CodeLanguagePicker.tsx +++ b/components/playground/CodeLanguagePicker.tsx @@ -15,7 +15,7 @@ export const CodeLanguagePicker = () => { {language.label}