@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
|
||||
import Cookies from 'js-cookie'
|
||||
import { SubNav, TabNav, UnderlineNav } from '@primer/components'
|
||||
import { sendEvent, EventType } from 'components/lib/events'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
import { useArticleContext } from 'components/context/ArticleContext'
|
||||
import parseUserAgent from 'components/lib/user-agent'
|
||||
@@ -50,6 +51,7 @@ type Props = {
|
||||
export const PlatformPicker = ({ variant = 'subnav' }: Props) => {
|
||||
const { defaultPlatform, detectedPlatforms } = useArticleContext()
|
||||
const [currentPlatform, setCurrentPlatform] = useState(defaultPlatform || '')
|
||||
const { asPath } = useRouter()
|
||||
|
||||
// Run on mount for client-side only features
|
||||
useEffect(() => {
|
||||
@@ -63,7 +65,7 @@ export const PlatformPicker = ({ variant = 'subnav' }: Props) => {
|
||||
|
||||
// always trigger this on initial render. if the default doesn't change the other useEffect won't fire
|
||||
showPlatformSpecificContent(platform)
|
||||
}, [])
|
||||
}, [asPath])
|
||||
|
||||
// Make sure we've always selected a platform that exists in the article
|
||||
useEffect(() => {
|
||||
|
||||
@@ -26,8 +26,8 @@ export const VersionPicker = ({ variant }: Props) => {
|
||||
selected: allVersions[currentVersion].versionTitle === permalink.pageVersionTitle,
|
||||
item: <Link href={permalink.href}>{permalink.pageVersionTitle}</Link>,
|
||||
}))
|
||||
const hasEnterpriseVersions = (page.permalinks || []).find((permalink) =>
|
||||
permalink.pageVersion.startsWith('enterprise-version')
|
||||
const hasEnterpriseVersions = (page.permalinks || []).some((permalink) =>
|
||||
permalink.pageVersion.startsWith('enterprise-server')
|
||||
)
|
||||
|
||||
if (hasEnterpriseVersions) {
|
||||
|
||||
@@ -53,7 +53,7 @@ pages:
|
||||
article_version: 'Article version'
|
||||
miniToc: In this article
|
||||
contributor_callout: This article is contributed and maintained by
|
||||
all_enterprise_releases: All Enterprise releases
|
||||
all_enterprise_releases: All Enterprise Server releases
|
||||
errors:
|
||||
oops: Ooops!
|
||||
something_went_wrong: It looks like something went wrong.
|
||||
|
||||
Reference in New Issue
Block a user