From 115d1f0a10a49b1339ffd8f56872fc63da11292b Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Fri, 6 Dec 2024 15:47:34 +0100 Subject: [PATCH] Suspense on --- .../(protected)/my-pages/[...path]/page.tsx | 6 ++- .../booking-confirmation/page.tsx | 12 ++++-- .../hotelreservation/(standard)/page.tsx | 6 ++- .../select-hotel/@modal/(.)map/page.tsx | 8 +++- .../(standard)/select-hotel/page.tsx | 10 +++-- .../(standard)/select-rate/page.tsx | 30 ++++++++------ .../(standard)/step/enterDetailsTracking.tsx | 39 +++++++++---------- .../hotelreservation/(standard)/step/page.tsx | 10 +++-- components/ContentType/LoyaltyPage/index.tsx | 7 +++- components/ContentType/StaticPages/index.tsx | 7 +++- components/Webviews/AccountPage/index.tsx | 6 ++- components/Webviews/LoyaltyPage/index.tsx | 6 ++- 12 files changed, 94 insertions(+), 53 deletions(-) diff --git a/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx b/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx index 4a94f599c..ddec0b715 100644 --- a/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx +++ b/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx @@ -1,3 +1,5 @@ +import { Suspense } from "react" + import { serverClient } from "@/lib/trpc/server" import Blocks from "@/components/Blocks" @@ -36,7 +38,9 @@ export default async function MyPages({

{intl.formatMessage({ id: "No content published" })}

)} - + + + ) } diff --git a/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx index c7ddbd55b..978b26eec 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(confirmation)/booking-confirmation/page.tsx @@ -1,4 +1,5 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" +import { Suspense } from "react" import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests" @@ -73,10 +74,13 @@ export default async function BookingConfirmationPage({ return ( <> - + + + + diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx index 7b21164f7..75a01b61c 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/page.tsx @@ -1,3 +1,5 @@ +import { Suspense } from "react" + import { Lang } from "@/constants/languages" import { env } from "@/env/server" @@ -32,7 +34,9 @@ export default function HotelReservationPage({ params }: PageArgs) { return (
New booking flow! Please report errors/issues in Slack. - + + +
) } diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/@modal/(.)map/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/@modal/(.)map/page.tsx index 8a46f880a..5d1021fa7 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/@modal/(.)map/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/@modal/(.)map/page.tsx @@ -1,5 +1,6 @@ import { differenceInCalendarDays, format, isWeekend } from "date-fns" import { notFound } from "next/navigation" +import { Suspense } from "react" import { Lang } from "@/constants/languages" import { env } from "@/env/server" @@ -113,7 +114,12 @@ export default async function SelectHotelMapPage({ filterList={filterList} cityCoordinates={cityCoordinates} /> - + + + ) } diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx index a2fd1b287..f248a25ca 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-hotel/page.tsx @@ -223,10 +223,12 @@ export default async function SelectHotelPage({ )} - + + + ) diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx index bfee7fbf8..32fe4883f 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx @@ -30,17 +30,17 @@ export default async function SelectRatePage({ }: PageArgs) { setLang(params.lang) - const locations = await getLocations() - if (!locations || "error" in locations) { - return null - } - const hotel = locations.data.find( - (location) => - "operaId" in location && location.operaId == searchParams.hotel - ) - if (!hotel) { - return notFound() - } + // const locations = await getLocations() + // if (!locations || "error" in locations) { + // return null + // } + // const hotel = locations.data.find( + // (location) => + // "operaId" in location && location.operaId == searchParams.hotel + // ) + // if (!hotel) { + // return notFound() + // } const selectRoomParams = new URLSearchParams(searchParams) const selectRoomParamsObject = getHotelReservationQueryParams(selectRoomParams) @@ -101,6 +101,7 @@ export default async function SelectRatePage({ } const hotelId = +searchParams.hotel + return ( <> - + + + ) } diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/enterDetailsTracking.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/enterDetailsTracking.tsx index 53e9ac5fd..a031296b7 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/enterDetailsTracking.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/enterDetailsTracking.tsx @@ -46,7 +46,6 @@ export default function EnterDetailsTracking(props: Props) { roomRate, packages, } = useEnterDetailsStore((state) => state) - const { getPageLoadTime, hasRun } = useTrackingStore() const pathName = usePathname() const sessionId = useSessionId() @@ -95,11 +94,11 @@ export default function EnterDetailsTracking(props: Props) { ...pageTrackingData, sessionId, pathName, - pageLoadTime: getPageLoadTime(), + pageLoadTime: 0, // Yes, this is instant } const pageObject = createSDKPageObject(trackingData) return pageObject - }, [currentStep, getPageLoadTime, lang, pathName, sessionId]) + }, [currentStep, lang, pathName, sessionId]) const hotelDetailsData = useMemo(() => { const isMember = true @@ -144,23 +143,23 @@ export default function EnterDetailsTracking(props: Props) { return } - if (previousPathname.current !== pathName) { - console.log("TRACKING: Tracking RouterTransition pageViewEnd", pageObject) - console.log( - "TRACKING: Tracking RouterTransition userData", - userTrackingData - ) - console.log( - "TRACKING: Tracking RouterTransition hotelInfo", - hotelDetailsData - ) - window.adobeDataLayer.push({ - event: "pageView", - pageInfo: pageObject, - userInfo: userTrackingData, - hotelInfo: hotelDetailsData, - }) - } + //if (previousPathname.current !== pathName) { + console.log("TRACKING: Tracking RouterTransition pageViewEnd", pageObject) + console.log( + "TRACKING: Tracking RouterTransition userData", + userTrackingData + ) + console.log( + "TRACKING: Tracking RouterTransition hotelInfo", + hotelDetailsData + ) + window.adobeDataLayer.push({ + event: "pageView", + pageInfo: pageObject, + userInfo: userTrackingData, + hotelInfo: hotelDetailsData, + }) + //} previousPathname.current = pathName // Update for next render }, [userTrackingData, pageObject, hotelDetailsData, pathName]) diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx index bb06f65fe..79bbd6375 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/step/page.tsx @@ -285,10 +285,12 @@ export default async function StepPage({ cancellationRule={roomAvailability.cancellationText} lang={lang} /> - + + + ) } diff --git a/components/ContentType/LoyaltyPage/index.tsx b/components/ContentType/LoyaltyPage/index.tsx index d28672daf..fb302ea39 100644 --- a/components/ContentType/LoyaltyPage/index.tsx +++ b/components/ContentType/LoyaltyPage/index.tsx @@ -1,3 +1,5 @@ +import { Suspense } from "react" + import { serverClient } from "@/lib/trpc/server" import Blocks from "@/components/Blocks" @@ -45,8 +47,9 @@ export default async function LoyaltyPage() { ) : null} - - + + + ) } diff --git a/components/ContentType/StaticPages/index.tsx b/components/ContentType/StaticPages/index.tsx index 4eed6b89b..822f095ad 100644 --- a/components/ContentType/StaticPages/index.tsx +++ b/components/ContentType/StaticPages/index.tsx @@ -1,3 +1,5 @@ +import { Suspense } from "react" + import Blocks from "@/components/Blocks" import Hero from "@/components/Hero" import Sidebar from "@/components/Sidebar" @@ -58,8 +60,9 @@ export default function StaticPage({ ) : null} - - + + + ) } diff --git a/components/Webviews/AccountPage/index.tsx b/components/Webviews/AccountPage/index.tsx index 572ea485e..724c1b1c0 100644 --- a/components/Webviews/AccountPage/index.tsx +++ b/components/Webviews/AccountPage/index.tsx @@ -1,6 +1,8 @@ import "@/app/globals.css" import "@scandic-hotels/design-system/style.css" +import { Suspense } from "react" + import { overview } from "@/constants/routes/webviews" import { serverClient } from "@/lib/trpc/server" @@ -31,7 +33,9 @@ export default async function AccountPage() { - + + + ) } diff --git a/components/Webviews/LoyaltyPage/index.tsx b/components/Webviews/LoyaltyPage/index.tsx index b14563772..6ff95e6d3 100644 --- a/components/Webviews/LoyaltyPage/index.tsx +++ b/components/Webviews/LoyaltyPage/index.tsx @@ -1,3 +1,5 @@ +import { Suspense } from "react" + import { serverClient } from "@/lib/trpc/server" import MaxWidth from "@/components/MaxWidth" @@ -27,7 +29,9 @@ export default async function AboutScandicFriends() { - + + + ) }