docs: disable retrieving Cloud pricing data on preview + other changes (#13552)
* docs: disable retrieving Cloud pricing data on preview + other changes * fixes
This commit is contained in:
@@ -1,16 +1,18 @@
|
|||||||
"use server"
|
|
||||||
|
|
||||||
import { sanityClient } from "../../utils/sanity-client"
|
import { sanityClient } from "../../utils/sanity-client"
|
||||||
import { PricingQueryResult } from "../../utils/types"
|
import { PricingQueryResult } from "../../utils/types"
|
||||||
import HeroPricing from "../../components/Pricing/HeroPricing"
|
import HeroPricing from "../../components/Pricing/HeroPricing"
|
||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import FeatureSections from "../../components/Pricing/FeatureSections"
|
import FeatureSections from "../../components/Pricing/FeatureSections"
|
||||||
import { H2, Hr, Loading } from "docs-ui"
|
import { H2, Hr } from "docs-ui"
|
||||||
import { cache, Suspense } from "react"
|
|
||||||
|
|
||||||
export default async function PricingPage() {
|
export default async function PricingPage() {
|
||||||
if (process.env.NEXT_PUBLIC_ENV === "CI") {
|
if (
|
||||||
return <div>Pricing page is not available in the CI environment.</div>
|
process.env.NEXT_PUBLIC_ENV === "CI" ||
|
||||||
|
process.env.NEXT_PUBLIC_VERCEL_ENV === "preview"
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<div>Pricing page is not available in the CI / Preview environment.</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const data = await loadPricingData()
|
const data = await loadPricingData()
|
||||||
|
|
||||||
@@ -26,7 +28,7 @@ export default async function PricingPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Suspense fallback={<Loading />}>
|
<div>
|
||||||
<H2 id="cloud-plans">Cloud Plans</H2>
|
<H2 id="cloud-plans">Cloud Plans</H2>
|
||||||
<HeroPricing data={heroPricingData.heroPricingFields} />
|
<HeroPricing data={heroPricingData.heroPricingFields} />
|
||||||
<Hr />
|
<Hr />
|
||||||
@@ -36,11 +38,11 @@ export default async function PricingPage() {
|
|||||||
columnCount={featureTableData.featureTableFields.columnHeaders.length}
|
columnCount={featureTableData.featureTableFields.columnHeaders.length}
|
||||||
columns={featureTableData.featureTableFields.columnHeaders}
|
columns={featureTableData.featureTableFields.columnHeaders}
|
||||||
/>
|
/>
|
||||||
</Suspense>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadPricingData = cache(async () => {
|
const loadPricingData = async () => {
|
||||||
const data: PricingQueryResult = await sanityClient.fetch(
|
const data: PricingQueryResult = await sanityClient.fetch(
|
||||||
`*[
|
`*[
|
||||||
(_type == "featureTable" && _id == "9cb4e359-786a-4cdb-9334-88ad4ce44f05") ||
|
(_type == "featureTable" && _id == "9cb4e359-786a-4cdb-9334-88ad4ce44f05") ||
|
||||||
@@ -65,4 +67,4 @@ const loadPricingData = cache(async () => {
|
|||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
return data
|
return data
|
||||||
})
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user