Merged in fix/destinationpages-loading-tweaks (pull request #1605)

Suspense destination pages fixes and some performance improvements

* Suspense destination pages fixes and some performance improvements


Approved-by: Erik Tiekstra
This commit is contained in:
Linus Flood
2025-03-24 08:27:16 +00:00
parent bcf0310872
commit 6197c7634f
5 changed files with 27 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import { headers } from "next/headers"
import { notFound, redirect } from "next/navigation"
import { Suspense } from "react"
import { overview } from "@/constants/routes/myPages"
import { isSignupPage } from "@/constants/routes/signup"
@@ -8,7 +9,9 @@ import { getHotelPage } from "@/lib/trpc/memoizedRequests"
import { auth } from "@/auth"
import DestinationCityPage from "@/components/ContentType/DestinationPage/DestinationCityPage"
import DestinationCityPageSkeleton from "@/components/ContentType/DestinationPage/DestinationCityPage/DestinationCityPageSkeleton"
import DestinationCountryPage from "@/components/ContentType/DestinationPage/DestinationCountryPage"
import DestinationCountryPageSkeleton from "@/components/ContentType/DestinationPage/DestinationCountryPage/DestinationCountryPageSkeleton"
import DestinationOverviewPage from "@/components/ContentType/DestinationPage/DestinationOverviewPage"
import HotelPage from "@/components/ContentType/HotelPage"
import HotelSubpage from "@/components/ContentType/HotelSubpage"
@@ -62,9 +65,17 @@ export default async function ContentTypePage({
case PageContentTypeEnum.destinationOverviewPage:
return <DestinationOverviewPage />
case PageContentTypeEnum.destinationCountryPage:
return <DestinationCountryPage />
return (
<Suspense fallback={<DestinationCountryPageSkeleton />}>
<DestinationCountryPage />
</Suspense>
)
case PageContentTypeEnum.destinationCityPage:
return <DestinationCityPage />
return (
<Suspense fallback={<DestinationCityPageSkeleton />}>
<DestinationCityPage />
</Suspense>
)
case PageContentTypeEnum.hotelPage:
if (env.HIDE_FOR_NEXT_RELEASE) {
return notFound()