Skip to content

Commit b84b627

Browse files
authored
Fix bug for ghec version of experimental pages (github#30494)
1 parent 219638d commit b84b627

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

components/context/PlaygroundContext.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ export const PlaygroundContextProvider = (props: { children: React.ReactNode })
5959
const router = useRouter()
6060
const [activeSectionIndex, setActiveSectionIndex] = useState(0)
6161
const [scrollToSection, setScrollToSection] = useState<number>()
62-
const path = router.asPath.split('?')[0].split('#')[0]
63-
62+
const path = router.asPath.includes('@latest')
63+
? router.asPath.split('?')[0].split('#')[0].split('@latest')[1]
64+
: router.asPath.split('?')[0].split('#')[0]
6465
const relevantArticles = articles.filter(({ slug }) => slug === path)
6566

6667
const { langId } = router.query

components/playground/CodeLanguagePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const CodeLanguagePicker = () => {
1515
<SubNav.Link
1616
key={language.id}
1717
as={Link}
18-
href={`${routePath}?langId=${language.id}`}
18+
href={`/${router.locale}${routePath}?langId=${language.id}`}
1919
selected={language.id === currentLanguage.id}
2020
>
2121
{language.label}

0 commit comments

Comments
 (0)