From 79a019300a72f0060b4954ad08afe8d659564c92 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Mon, 18 Nov 2024 09:40:16 -0500 Subject: [PATCH] Bump deps + Next 15 --- .../admin/(default)/badges/[badgeId]/page.tsx | 11 +++++---- .../admin/(default)/events/[eventId]/page.tsx | 11 +++++---- .../locations/[countrySlug]/(tabs)/layout.tsx | 15 +++++++----- .../locations/[countrySlug]/(tabs)/page.tsx | 11 +++++---- .../regions/[regionSlug]/page.tsx | 11 +++++---- .../(default)/sites/[siteId]/(tabs)/page.tsx | 11 +++++---- .../sites/[siteId]/(tabs)/reviews/page.tsx | 11 +++++---- .../admin/(default)/sites/[siteId]/layout.tsx | 15 +++++++----- .../admin/(default)/tags/[tagId]/page.tsx | 11 +++++---- .../badges/[badgeId]/edit/page.tsx | 11 +++++---- .../events/[eventId]/edit/page.tsx | 11 +++++---- .../locations/[countrySlug]/edit/page.tsx | 11 +++++---- .../regions/[regionSlug]/edit/page.tsx | 11 +++++---- .../sites/[siteId]/edit/page.tsx | 11 +++++---- .../(layout-free)/tags/[tagId]/edit/page.tsx | 11 +++++---- .../app/(default)/badges/[badgeId]/page.tsx | 20 +++++++++------- .../bottles/[bottleId]/(tabs)/layout.tsx | 11 +++++---- .../bottles/[bottleId]/(tabs)/page.tsx | 20 +++++++++------- .../bottles/[bottleId]/(tabs)/prices/page.tsx | 20 +++++++++------- .../[bottleId]/(tabs)/similar/page.tsx | 20 +++++++++------- .../[bottleId]/(tabs)/tastings/page.tsx | 20 +++++++++------- .../bottles/[bottleId]/aliases/layout.tsx | 10 ++++---- .../bottles/[bottleId]/aliases/page.tsx | 11 +++++---- .../(default)/bottles/[bottleId]/layout.tsx | 11 +++++---- .../[entityId]/(tabs)/bottles/layout.tsx | 10 ++++---- .../[entityId]/(tabs)/bottles/page.tsx | 11 +++++---- .../entities/[entityId]/(tabs)/codes/page.tsx | 20 +++++++++------- .../entities/[entityId]/(tabs)/layout.tsx | 13 +++++++---- .../entities/[entityId]/(tabs)/page.tsx | 20 +++++++++------- .../[entityId]/(tabs)/tastings/page.tsx | 20 +++++++++------- .../entities/[entityId]/aliases/layout.tsx | 10 ++++---- .../entities/[entityId]/aliases/page.tsx | 11 +++++---- .../(default)/entities/[entityId]/layout.tsx | 11 +++++---- .../app/(default)/flights/[flightId]/page.tsx | 20 +++++++++------- .../locations/[countrySlug]/(tabs)/layout.tsx | 23 +++++++++++-------- .../locations/[countrySlug]/(tabs)/page.tsx | 11 +++++---- .../[countrySlug]/(tabs)/regions/layout.tsx | 10 ++++---- .../[countrySlug]/(tabs)/regions/page.tsx | 11 +++++---- .../regions/[regionSlug]/(tabs)/layout.tsx | 23 +++++++++++-------- .../regions/[regionSlug]/(tabs)/page.tsx | 11 +++++---- .../(default)/tastings/[tastingId]/page.tsx | 20 +++++++++------- .../[username]/(tabs)/favorites/page.tsx | 20 +++++++++------- .../users/[username]/(tabs)/page.tsx | 20 +++++++++------- .../app/(default)/users/[username]/layout.tsx | 13 +++++++---- .../bottles/[bottleId]/addTasting/page.tsx | 11 +++++---- .../bottles/[bottleId]/edit/page.tsx | 11 +++++---- .../bottles/[bottleId]/merge/page.tsx | 12 ++++++---- .../entities/[entityId]/edit/page.tsx | 11 +++++---- .../entities/[entityId]/merge/page.tsx | 12 +++++----- .../flights/[flightId]/edit/page.tsx | 11 +++++---- .../flights/[flightId]/overlay/page.tsx | 11 +++++---- .../web/src/app/(layout-free)/search/page.tsx | 7 +++--- .../tastings/[tastingId]/edit/page.tsx | 11 +++++---- apps/web/src/app/password-reset/page.tsx | 7 +++--- .../bottles/[id]/sitemap.xml/route.ts | 6 ++++- .../entities/[id]/sitemap.xml/route.ts | 6 ++++- apps/web/src/lib/session.server.ts | 2 +- 57 files changed, 443 insertions(+), 299 deletions(-) diff --git a/apps/web/src/app/(admin)/admin/(default)/badges/[badgeId]/page.tsx b/apps/web/src/app/(admin)/admin/(default)/badges/[badgeId]/page.tsx index 83f22b844..e48b14958 100644 --- a/apps/web/src/app/(admin)/admin/(default)/badges/[badgeId]/page.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/badges/[badgeId]/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import BadgeImage from "@peated/web/components/badgeImage"; import { Breadcrumbs } from "@peated/web/components/breadcrumbs"; @@ -11,11 +12,11 @@ import PageHeader from "@peated/web/components/pageHeader"; import Tabs, { TabItem } from "@peated/web/components/tabs"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { badgeId }, -}: { - params: { badgeId: string }; -}) { +export default function Page(props: { params: Promise<{ badgeId: string }> }) { + const params = use(props.params); + + const { badgeId } = params; + const [badge] = trpc.badgeById.useSuspenseQuery(parseInt(badgeId, 10)); return ( diff --git a/apps/web/src/app/(admin)/admin/(default)/events/[eventId]/page.tsx b/apps/web/src/app/(admin)/admin/(default)/events/[eventId]/page.tsx index 0647cc76a..f399cc92a 100644 --- a/apps/web/src/app/(admin)/admin/(default)/events/[eventId]/page.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/events/[eventId]/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import { Breadcrumbs } from "@peated/web/components/breadcrumbs"; import Button from "@peated/web/components/button"; @@ -11,11 +12,11 @@ import PageHeader from "@peated/web/components/pageHeader"; import Tabs, { TabItem } from "@peated/web/components/tabs"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { eventId }, -}: { - params: { eventId: string }; -}) { +export default function Page(props: { params: Promise<{ eventId: string }> }) { + const params = use(props.params); + + const { eventId } = params; + const [event] = trpc.eventById.useSuspenseQuery(parseInt(eventId, 10)); return ( diff --git a/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/layout.tsx b/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/layout.tsx index 17df997e4..96cab6449 100644 --- a/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/layout.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/layout.tsx @@ -6,15 +6,18 @@ import Link from "@peated/web/components/link"; import PageHeader from "@peated/web/components/pageHeader"; import Tabs, { TabItem } from "@peated/web/components/tabs"; import { trpc } from "@peated/web/lib/trpc/client"; -import { type ReactNode } from "react"; +import { type ReactNode, use } from "react"; -export default function Page({ - params: { countrySlug }, - children, -}: { - params: { countrySlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string }>; children: ReactNode; }) { + const params = use(props.params); + + const { countrySlug } = params; + + const { children } = props; + const [country] = trpc.countryBySlug.useSuspenseQuery(countrySlug); return ( diff --git a/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/page.tsx b/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/page.tsx index 933271cff..89fc21191 100644 --- a/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/page.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/(tabs)/page.tsx @@ -1,14 +1,17 @@ "use client"; +import { use } from "react"; import Table from "@peated/web/components/table"; import useApiQueryParams from "@peated/web/hooks/useApiQueryParams"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { countrySlug }, -}: { - params: { countrySlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string }>; }) { + const params = use(props.params); + + const { countrySlug } = params; + const queryParams = useApiQueryParams({ defaults: { sort: "-created", diff --git a/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/regions/[regionSlug]/page.tsx b/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/regions/[regionSlug]/page.tsx index 79a61dc84..f72078b7c 100644 --- a/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/regions/[regionSlug]/page.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/locations/[countrySlug]/regions/[regionSlug]/page.tsx @@ -1,15 +1,18 @@ "use client"; +import { use } from "react"; import { Breadcrumbs } from "@peated/web/components/breadcrumbs"; import Button from "@peated/web/components/button"; import PageHeader from "@peated/web/components/pageHeader"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { countrySlug, regionSlug }, -}: { - params: { countrySlug: string; regionSlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string; regionSlug: string }>; }) { + const params = use(props.params); + + const { countrySlug, regionSlug } = params; + const [country] = trpc.countryBySlug.useSuspenseQuery(countrySlug); const [region] = trpc.regionBySlug.useSuspenseQuery({ country: countrySlug, diff --git a/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/page.tsx b/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/page.tsx index b2271ce0c..89f34a1f8 100644 --- a/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/page.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import { type ExternalSiteType } from "@peated/server/types"; import StorePriceTable from "@peated/web/components/admin/storePriceTable"; @@ -6,11 +7,13 @@ import EmptyActivity from "@peated/web/components/emptyActivity"; import useApiQueryParams from "@peated/web/hooks/useApiQueryParams"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { siteId }, -}: { - params: { siteId: ExternalSiteType }; +export default function Page(props: { + params: Promise<{ siteId: ExternalSiteType }>; }) { + const params = use(props.params); + + const { siteId } = params; + const queryParams = useApiQueryParams({ numericFields: ["cursor", "limit"], overrides: { diff --git a/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/reviews/page.tsx b/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/reviews/page.tsx index 33b7c6276..a40370642 100644 --- a/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/reviews/page.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/(tabs)/reviews/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import { type ExternalSiteType } from "@peated/server/types"; import ReviewTable from "@peated/web/components/admin/reviewTable"; @@ -6,11 +7,13 @@ import EmptyActivity from "@peated/web/components/emptyActivity"; import useApiQueryParams from "@peated/web/hooks/useApiQueryParams"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { siteId }, -}: { - params: { siteId: ExternalSiteType }; +export default function Page(props: { + params: Promise<{ siteId: ExternalSiteType }>; }) { + const params = use(props.params); + + const { siteId } = params; + const queryParams = useApiQueryParams({ overrides: { site: siteId, diff --git a/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/layout.tsx b/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/layout.tsx index 673f356f1..d349a2333 100644 --- a/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/layout.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/sites/[siteId]/layout.tsx @@ -9,7 +9,7 @@ import Tabs, { TabItem } from "@peated/web/components/tabs"; import TimeSince from "@peated/web/components/timeSince"; import { formatDuration } from "@peated/web/lib/format"; import { trpc } from "@peated/web/lib/trpc/client"; -import { useState, type ReactNode } from "react"; +import { use, useState, type ReactNode } from "react"; import { type z } from "zod"; type UpdateSiteFn = (data: z.infer) => void; @@ -43,13 +43,16 @@ function TriggerJobButton({ ); } -export default function Layout({ - params: { siteId }, - children, -}: { - params: { siteId: string }; +export default function Layout(props: { + params: Promise<{ siteId: string }>; children: ReactNode; }) { + const params = use(props.params); + + const { siteId } = params; + + const { children } = props; + const [initialSite] = trpc.externalSiteByType.useSuspenseQuery( siteId as ExternalSiteType, ); diff --git a/apps/web/src/app/(admin)/admin/(default)/tags/[tagId]/page.tsx b/apps/web/src/app/(admin)/admin/(default)/tags/[tagId]/page.tsx index 10c90e649..64493273e 100644 --- a/apps/web/src/app/(admin)/admin/(default)/tags/[tagId]/page.tsx +++ b/apps/web/src/app/(admin)/admin/(default)/tags/[tagId]/page.tsx @@ -1,15 +1,16 @@ "use client"; +import { use } from "react"; import { toTitleCase } from "@peated/server/lib/strings"; import { Breadcrumbs } from "@peated/web/components/breadcrumbs"; import Button from "@peated/web/components/button"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { tagId }, -}: { - params: { tagId: string }; -}) { +export default function Page(props: { params: Promise<{ tagId: string }> }) { + const params = use(props.params); + + const { tagId } = params; + const [tag] = trpc.tagByName.useSuspenseQuery(tagId); return ( diff --git a/apps/web/src/app/(admin)/admin/(layout-free)/badges/[badgeId]/edit/page.tsx b/apps/web/src/app/(admin)/admin/(layout-free)/badges/[badgeId]/edit/page.tsx index c6bed29fa..664c33235 100644 --- a/apps/web/src/app/(admin)/admin/(layout-free)/badges/[badgeId]/edit/page.tsx +++ b/apps/web/src/app/(admin)/admin/(layout-free)/badges/[badgeId]/edit/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import BadgeForm from "@peated/web/components/admin/badgeForm"; import { useFlashMessages } from "@peated/web/components/flash"; @@ -8,11 +9,11 @@ import { logError } from "@peated/web/lib/log"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -export default function Page({ - params: { badgeId }, -}: { - params: { badgeId: string }; -}) { +export default function Page(props: { params: Promise<{ badgeId: string }> }) { + const params = use(props.params); + + const { badgeId } = params; + const [badge] = trpc.badgeById.useSuspenseQuery(parseInt(badgeId, 10)); const router = useRouter(); diff --git a/apps/web/src/app/(admin)/admin/(layout-free)/events/[eventId]/edit/page.tsx b/apps/web/src/app/(admin)/admin/(layout-free)/events/[eventId]/edit/page.tsx index 3db2ea349..0d6a0f6b2 100644 --- a/apps/web/src/app/(admin)/admin/(layout-free)/events/[eventId]/edit/page.tsx +++ b/apps/web/src/app/(admin)/admin/(layout-free)/events/[eventId]/edit/page.tsx @@ -1,14 +1,15 @@ "use client"; +import { use } from "react"; import EventForm from "@peated/web/components/admin/eventForm"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -export default function Page({ - params: { eventId }, -}: { - params: { eventId: string }; -}) { +export default function Page(props: { params: Promise<{ eventId: string }> }) { + const params = use(props.params); + + const { eventId } = params; + const [event] = trpc.eventById.useSuspenseQuery(parseInt(eventId, 10)); const router = useRouter(); diff --git a/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/edit/page.tsx b/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/edit/page.tsx index c678ea653..ec5fa3ff1 100644 --- a/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/edit/page.tsx +++ b/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/edit/page.tsx @@ -1,15 +1,18 @@ "use client"; +import { use } from "react"; import CountryForm from "@peated/web/components/admin/countryForm"; import { useModRequired } from "@peated/web/hooks/useAuthRequired"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter, useSearchParams } from "next/navigation"; -export default function Page({ - params: { countrySlug }, -}: { - params: { countrySlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string }>; }) { + const params = use(props.params); + + const { countrySlug } = params; + useModRequired(); const [country] = trpc.countryBySlug.useSuspenseQuery(countrySlug); diff --git a/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/regions/[regionSlug]/edit/page.tsx b/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/regions/[regionSlug]/edit/page.tsx index 4ef8e4d1a..ac1856357 100644 --- a/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/regions/[regionSlug]/edit/page.tsx +++ b/apps/web/src/app/(admin)/admin/(layout-free)/locations/[countrySlug]/regions/[regionSlug]/edit/page.tsx @@ -1,15 +1,18 @@ "use client"; +import { use } from "react"; import RegionForm from "@peated/web/components/admin/regionForm"; import { useModRequired } from "@peated/web/hooks/useAuthRequired"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter, useSearchParams } from "next/navigation"; -export default function Page({ - params: { countrySlug, regionSlug }, -}: { - params: { countrySlug: string; regionSlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string; regionSlug: string }>; }) { + const params = use(props.params); + + const { countrySlug, regionSlug } = params; + useModRequired(); const [region] = trpc.regionBySlug.useSuspenseQuery({ diff --git a/apps/web/src/app/(admin)/admin/(layout-free)/sites/[siteId]/edit/page.tsx b/apps/web/src/app/(admin)/admin/(layout-free)/sites/[siteId]/edit/page.tsx index fc11c87dc..7d6102f0a 100644 --- a/apps/web/src/app/(admin)/admin/(layout-free)/sites/[siteId]/edit/page.tsx +++ b/apps/web/src/app/(admin)/admin/(layout-free)/sites/[siteId]/edit/page.tsx @@ -1,15 +1,18 @@ "use client"; +import { use } from "react"; import { type ExternalSiteType } from "@peated/server/types"; import SiteForm from "@peated/web/components/admin/siteForm"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -export default function Page({ - params: { siteId }, -}: { - params: { siteId: ExternalSiteType }; +export default function Page(props: { + params: Promise<{ siteId: ExternalSiteType }>; }) { + const params = use(props.params); + + const { siteId } = params; + const [site] = trpc.externalSiteByType.useSuspenseQuery(siteId); const router = useRouter(); diff --git a/apps/web/src/app/(admin)/admin/(layout-free)/tags/[tagId]/edit/page.tsx b/apps/web/src/app/(admin)/admin/(layout-free)/tags/[tagId]/edit/page.tsx index 43377f200..b246c5f3b 100644 --- a/apps/web/src/app/(admin)/admin/(layout-free)/tags/[tagId]/edit/page.tsx +++ b/apps/web/src/app/(admin)/admin/(layout-free)/tags/[tagId]/edit/page.tsx @@ -1,14 +1,15 @@ "use client"; +import { use } from "react"; import TagForm from "@peated/web/components/admin/tagForm"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -export default function Page({ - params: { tagId }, -}: { - params: { tagId: string }; -}) { +export default function Page(props: { params: Promise<{ tagId: string }> }) { + const params = use(props.params); + + const { tagId } = params; + const [tag] = trpc.tagByName.useSuspenseQuery(tagId); const router = useRouter(); diff --git a/apps/web/src/app/(default)/badges/[badgeId]/page.tsx b/apps/web/src/app/(default)/badges/[badgeId]/page.tsx index 8e9f6d242..afcf16dd3 100644 --- a/apps/web/src/app/(default)/badges/[badgeId]/page.tsx +++ b/apps/web/src/app/(default)/badges/[badgeId]/page.tsx @@ -6,11 +6,13 @@ import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { Suspense } from "react"; import Leaderboard from "./leaderboard"; -export async function generateMetadata({ - params: { badgeId }, -}: { - params: { badgeId: string }; +export async function generateMetadata(props: { + params: Promise<{ badgeId: string }>; }) { + const params = await props.params; + + const { badgeId } = params; + const trpcClient = await getTrpcClient(); const badge = await trpcClient.badgeById.fetch(parseInt(badgeId, 10)); @@ -19,11 +21,13 @@ export async function generateMetadata({ }; } -export default async function Page({ - params: { badgeId }, -}: { - params: { badgeId: string }; +export default async function Page(props: { + params: Promise<{ badgeId: string }>; }) { + const params = await props.params; + + const { badgeId } = params; + if (!(await isLoggedIn())) { return redirectToAuth({ pathname: `/badges/${badgeId}` }); } diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/layout.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/layout.tsx index 0bb61dbab..5269b1f09 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/layout.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/layout.tsx @@ -3,13 +3,14 @@ import Tabs, { TabItem } from "@peated/web/components/tabs"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { type ReactNode } from "react"; -export default async function Layout({ - params, - children, -}: { - params: Record; +export default async function Layout(props: { + params: Promise>; children: ReactNode; }) { + const params = await props.params; + + const { children } = props; + const bottleId = Number(params.bottleId); const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(bottleId); diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/page.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/page.tsx index 430b49e20..ddacaf650 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/page.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/page.tsx @@ -3,11 +3,13 @@ import BottleStats from "@peated/web/components/bottleStats"; import { summarize } from "@peated/web/lib/markdown"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; -export async function generateMetadata({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export async function generateMetadata(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(Number(bottleId)); @@ -29,11 +31,13 @@ export async function generateMetadata({ }; } -export default async function BottleDetails({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export default async function BottleDetails(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(Number(bottleId)); diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/prices/page.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/prices/page.tsx index f1111b628..bfadd5811 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/prices/page.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/prices/page.tsx @@ -3,11 +3,13 @@ import Price from "@peated/web/components/price"; import TimeSince from "@peated/web/components/timeSince"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; -export async function generateMetadata({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export async function generateMetadata(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(Number(bottleId)); @@ -16,11 +18,13 @@ export async function generateMetadata({ }; } -export default async function BottlePrices({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export default async function BottlePrices(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const priceList = await trpcClient.bottlePriceList.fetch({ bottle: Number(bottleId), diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/similar/page.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/similar/page.tsx index f9f414970..61fbf2997 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/similar/page.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/similar/page.tsx @@ -2,11 +2,13 @@ import BetaNotice from "@peated/web/components/betaNotice"; import BottleTable from "@peated/web/components/bottleTable"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; -export async function generateMetadata({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export async function generateMetadata(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(Number(bottleId)); @@ -15,11 +17,13 @@ export async function generateMetadata({ }; } -export default async function BottlePrices({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export default async function BottlePrices(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const bottleList = await trpcClient.similarBottleList.fetch({ bottle: Number(bottleId), diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/tastings/page.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/tastings/page.tsx index 57d0920bd..f59cecf05 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/tastings/page.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/(tabs)/tastings/page.tsx @@ -2,11 +2,13 @@ import EmptyActivity from "@peated/web/components/emptyActivity"; import TastingList from "@peated/web/components/tastingList"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; -export async function generateMetadata({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export async function generateMetadata(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(Number(bottleId)); @@ -15,11 +17,13 @@ export async function generateMetadata({ }; } -export default async function BottleTastings({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export default async function BottleTastings(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const tastingList = await trpcClient.tastingList.fetch({ bottle: Number(bottleId), diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/aliases/layout.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/aliases/layout.tsx index 6646fa663..d9c901106 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/aliases/layout.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/aliases/layout.tsx @@ -2,11 +2,13 @@ import SimpleHeader from "@peated/web/components/simpleHeader"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { type ReactNode } from "react"; -export async function generateMetadata({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export async function generateMetadata(props: { + params: Promise<{ bottleId: string }>; }) { + const params = await props.params; + + const { bottleId } = params; + const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(Number(bottleId)); diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/aliases/page.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/aliases/page.tsx index acdb679d0..cb9faef8a 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/aliases/page.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/aliases/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import Chip from "@peated/web/components/chip"; import ConfirmationButton from "@peated/web/components/confirmationButton"; @@ -7,11 +8,13 @@ import TimeSince from "@peated/web/components/timeSince"; import useAuth from "@peated/web/hooks/useAuth"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function BottleAliases({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export default function BottleAliases(props: { + params: Promise<{ bottleId: string }>; }) { + const params = use(props.params); + + const { bottleId } = params; + const { user } = useAuth(); const [aliasList] = trpc.bottleAliasList.useSuspenseQuery({ bottle: Number(bottleId), diff --git a/apps/web/src/app/(default)/bottles/[bottleId]/layout.tsx b/apps/web/src/app/(default)/bottles/[bottleId]/layout.tsx index d0fa00573..9f8d4a07c 100644 --- a/apps/web/src/app/(default)/bottles/[bottleId]/layout.tsx +++ b/apps/web/src/app/(default)/bottles/[bottleId]/layout.tsx @@ -9,13 +9,14 @@ import { redirect } from "next/navigation"; import { Suspense, type ReactNode } from "react"; import ModActions from "./modActions"; -export default async function Layout({ - params, - children, -}: { - params: Record; +export default async function Layout(props: { + params: Promise>; children: ReactNode; }) { + const params = await props.params; + + const { children } = props; + const bottleId = Number(params.bottleId); const trpcClient = await getTrpcClient(); const bottle = await trpcClient.bottleById.fetch(bottleId); diff --git a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/layout.tsx b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/layout.tsx index 8dfdf5929..74fc0d8df 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/layout.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/layout.tsx @@ -3,11 +3,13 @@ import { type ReactNode } from "react"; export const fetchCache = "default-no-store"; -export async function generateMetadata({ - params: { entityId }, -}: { - params: { entityId: string }; +export async function generateMetadata(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); diff --git a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/page.tsx b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/page.tsx index 391805756..c5acedeef 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/page.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/bottles/page.tsx @@ -1,14 +1,17 @@ "use client"; +import { use } from "react"; import BottleTable from "@peated/web/components/bottleTable"; import useApiQueryParams from "@peated/web/hooks/useApiQueryParams"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function EntityTastings({ - params: { entityId }, -}: { - params: { entityId: string }; +export default function EntityTastings(props: { + params: Promise<{ entityId: string }>; }) { + const params = use(props.params); + + const { entityId } = params; + const queryParams = useApiQueryParams({ defaults: { sort: "brand", diff --git a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/codes/page.tsx b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/codes/page.tsx index 50842f8d8..49409fd83 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/codes/page.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/codes/page.tsx @@ -9,11 +9,13 @@ import { notFound } from "next/navigation"; export const dynamic = "force-static"; -export async function generateMetadata({ - params: { entityId }, -}: { - params: { entityId: string }; +export async function generateMetadata(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); @@ -26,11 +28,13 @@ export async function generateMetadata({ }; } -export default async function Page({ - params: { entityId }, -}: { - params: { entityId: string }; +export default async function Page(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); diff --git a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/layout.tsx b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/layout.tsx index fd2519a6f..453fec86b 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/layout.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/layout.tsx @@ -3,13 +3,16 @@ import Tabs, { TabItem } from "@peated/web/components/tabs"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { type ReactNode } from "react"; -export default async function Layout({ - params: { entityId }, - children, -}: { - params: { entityId: string }; +export default async function Layout(props: { + params: Promise<{ entityId: string }>; children: ReactNode; }) { + const params = await props.params; + + const { entityId } = params; + + const { children } = props; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); diff --git a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/page.tsx b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/page.tsx index ccf109baa..360840904 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/page.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/page.tsx @@ -7,11 +7,13 @@ import { summarize } from "@peated/web/lib/markdown"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { parseDomain } from "@peated/web/lib/urls"; -export async function generateMetadata({ - params: { entityId }, -}: { - params: { entityId: string }; +export async function generateMetadata(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); @@ -30,11 +32,13 @@ export async function generateMetadata({ }; } -export default async function EntityDetails({ - params: { entityId }, -}: { - params: { entityId: string }; +export default async function EntityDetails(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); diff --git a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/tastings/page.tsx b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/tastings/page.tsx index 2865af823..e7a4b2b17 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/(tabs)/tastings/page.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/(tabs)/tastings/page.tsx @@ -2,11 +2,13 @@ import EmptyActivity from "@peated/web/components/emptyActivity"; import TastingList from "@peated/web/components/tastingList"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; -export async function generateMetadata({ - params: { entityId }, -}: { - params: { entityId: string }; +export async function generateMetadata(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); @@ -15,11 +17,13 @@ export async function generateMetadata({ }; } -export default async function EntityTastings({ - params: { entityId }, -}: { - params: { entityId: string }; +export default async function EntityTastings(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const tastingList = await trpcClient.tastingList.fetch({ entity: Number(entityId), diff --git a/apps/web/src/app/(default)/entities/[entityId]/aliases/layout.tsx b/apps/web/src/app/(default)/entities/[entityId]/aliases/layout.tsx index abd7ce86b..74a217314 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/aliases/layout.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/aliases/layout.tsx @@ -2,11 +2,13 @@ import SimpleHeader from "@peated/web/components/simpleHeader"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { type ReactNode } from "react"; -export async function generateMetadata({ - params: { entityId }, -}: { - params: { entityId: string }; +export async function generateMetadata(props: { + params: Promise<{ entityId: string }>; }) { + const params = await props.params; + + const { entityId } = params; + const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(Number(entityId)); diff --git a/apps/web/src/app/(default)/entities/[entityId]/aliases/page.tsx b/apps/web/src/app/(default)/entities/[entityId]/aliases/page.tsx index 0cb9dab92..3e508f9d2 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/aliases/page.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/aliases/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import Chip from "@peated/web/components/chip"; import ConfirmationButton from "@peated/web/components/confirmationButton"; @@ -7,11 +8,13 @@ import TimeSince from "@peated/web/components/timeSince"; import useAuth from "@peated/web/hooks/useAuth"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function EntityAliases({ - params: { entityId }, -}: { - params: { entityId: string }; +export default function EntityAliases(props: { + params: Promise<{ entityId: string }>; }) { + const params = use(props.params); + + const { entityId } = params; + const { user } = useAuth(); const [aliasList] = trpc.entityAliasList.useSuspenseQuery({ entity: Number(entityId), diff --git a/apps/web/src/app/(default)/entities/[entityId]/layout.tsx b/apps/web/src/app/(default)/entities/[entityId]/layout.tsx index 3e683164a..575a85112 100644 --- a/apps/web/src/app/(default)/entities/[entityId]/layout.tsx +++ b/apps/web/src/app/(default)/entities/[entityId]/layout.tsx @@ -6,13 +6,14 @@ import { redirect } from "next/navigation"; import { type ReactNode } from "react"; import ModActions from "./modActions"; -export default async function Layout({ - params, - children, -}: { - params: Record; +export default async function Layout(props: { + params: Promise>; children: ReactNode; }) { + const params = await props.params; + + const { children } = props; + const entityId = Number(params.entityId); const trpcClient = await getTrpcClient(); const entity = await trpcClient.entityById.fetch(entityId); diff --git a/apps/web/src/app/(default)/flights/[flightId]/page.tsx b/apps/web/src/app/(default)/flights/[flightId]/page.tsx index a185c0f33..3a27602fa 100644 --- a/apps/web/src/app/(default)/flights/[flightId]/page.tsx +++ b/apps/web/src/app/(default)/flights/[flightId]/page.tsx @@ -7,11 +7,13 @@ import { summarize } from "@peated/web/lib/markdown"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import ModActions from "./modActions"; -export async function generateMetadata({ - params: { flightId }, -}: { - params: { flightId: string }; +export async function generateMetadata(props: { + params: Promise<{ flightId: string }>; }) { + const params = await props.params; + + const { flightId } = params; + const trpcClient = await getTrpcClient(); const flight = await trpcClient.flightById.fetch(flightId); const description = summarize(flight.description || "", 200); @@ -22,11 +24,13 @@ export async function generateMetadata({ }; } -export default async function Page({ - params: { flightId }, -}: { - params: { flightId: string }; +export default async function Page(props: { + params: Promise<{ flightId: string }>; }) { + const params = await props.params; + + const { flightId } = params; + const trpcClient = await getTrpcClient(); const [flight, bottleList] = await Promise.all([ trpcClient.flightById.fetch(flightId), diff --git a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/layout.tsx b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/layout.tsx index 0887ebb8a..9e30703df 100644 --- a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/layout.tsx +++ b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/layout.tsx @@ -9,11 +9,13 @@ import { getCurrentUser } from "@peated/web/lib/auth.server"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { type ReactNode } from "react"; -export async function generateMetadata({ - params: { countrySlug }, -}: { - params: { countrySlug: string }; +export async function generateMetadata(props: { + params: Promise<{ countrySlug: string }>; }) { + const params = await props.params; + + const { countrySlug } = params; + const trpcClient = await getTrpcClient(); const country = await trpcClient.countryBySlug.fetch(countrySlug); @@ -23,13 +25,16 @@ export async function generateMetadata({ }; } -export default async function Page({ - params: { countrySlug }, - children, -}: { - params: { countrySlug: string }; +export default async function Page(props: { + params: Promise<{ countrySlug: string }>; children: ReactNode; }) { + const params = await props.params; + + const { countrySlug } = params; + + const { children } = props; + const trpcClient = await getTrpcClient(); const country = await trpcClient.countryBySlug.fetch(countrySlug); const user = await getCurrentUser(); diff --git a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/page.tsx b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/page.tsx index 94cef4d41..3787d2f3b 100644 --- a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/page.tsx +++ b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import EmptyActivity from "@peated/web/components/emptyActivity"; import EntityTable from "@peated/web/components/entityTable"; @@ -6,11 +7,13 @@ import PaginationButtons from "@peated/web/components/paginationButtons"; import useApiQueryParams from "@peated/web/hooks/useApiQueryParams"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { countrySlug }, -}: { - params: { countrySlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string }>; }) { + const params = use(props.params); + + const { countrySlug } = params; + const queryParams = useApiQueryParams({ numericFields: ["cursor", "limit"], overrides: { diff --git a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/layout.tsx b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/layout.tsx index 55044079c..10930e5a5 100644 --- a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/layout.tsx +++ b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/layout.tsx @@ -2,11 +2,13 @@ import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; export { default } from "@peated/web/components/defaultLayout"; -export async function generateMetadata({ - params: { countrySlug }, -}: { - params: { countrySlug: string }; +export async function generateMetadata(props: { + params: Promise<{ countrySlug: string }>; }) { + const params = await props.params; + + const { countrySlug } = params; + const trpcClient = await getTrpcClient(); const country = await trpcClient.countryBySlug.fetch(countrySlug); diff --git a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/page.tsx b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/page.tsx index 10a1ce167..d50bfb179 100644 --- a/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/page.tsx +++ b/apps/web/src/app/(default)/locations/[countrySlug]/(tabs)/regions/page.tsx @@ -1,14 +1,17 @@ "use client"; +import { use } from "react"; import Table from "@peated/web/components/table"; import useApiQueryParams from "@peated/web/hooks/useApiQueryParams"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { countrySlug }, -}: { - params: { countrySlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string }>; }) { + const params = use(props.params); + + const { countrySlug } = params; + const queryParams = useApiQueryParams({ numericFields: ["cursor", "limit"], overrides: { diff --git a/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/layout.tsx b/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/layout.tsx index 60ce9e9e4..e3302a264 100644 --- a/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/layout.tsx +++ b/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/layout.tsx @@ -9,11 +9,13 @@ import { getCurrentUser } from "@peated/web/lib/auth.server"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; import { type ReactNode } from "react"; -export async function generateMetadata({ - params: { countrySlug, regionSlug }, -}: { - params: { countrySlug: string; regionSlug: string }; +export async function generateMetadata(props: { + params: Promise<{ countrySlug: string; regionSlug: string }>; }) { + const params = await props.params; + + const { countrySlug, regionSlug } = params; + const trpcClient = await getTrpcClient(); const region = await trpcClient.regionBySlug.fetch({ country: countrySlug, @@ -26,13 +28,16 @@ export async function generateMetadata({ }; } -export default async function Page({ - params: { countrySlug, regionSlug }, - children, -}: { - params: { countrySlug: string; regionSlug: string }; +export default async function Page(props: { + params: Promise<{ countrySlug: string; regionSlug: string }>; children: ReactNode; }) { + const params = await props.params; + + const { countrySlug, regionSlug } = params; + + const { children } = props; + const trpcClient = await getTrpcClient(); const region = await trpcClient.regionBySlug.fetch({ country: countrySlug, diff --git a/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/page.tsx b/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/page.tsx index 05e166bfc..ca2bb1852 100644 --- a/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/page.tsx +++ b/apps/web/src/app/(default)/locations/[countrySlug]/regions/[regionSlug]/(tabs)/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import EmptyActivity from "@peated/web/components/emptyActivity"; import EntityTable from "@peated/web/components/entityTable"; @@ -6,11 +7,13 @@ import PaginationButtons from "@peated/web/components/paginationButtons"; import useApiQueryParams from "@peated/web/hooks/useApiQueryParams"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { countrySlug, regionSlug }, -}: { - params: { countrySlug: string; regionSlug: string }; +export default function Page(props: { + params: Promise<{ countrySlug: string; regionSlug: string }>; }) { + const params = use(props.params); + + const { countrySlug, regionSlug } = params; + const queryParams = useApiQueryParams({ numericFields: ["cursor", "limit"], overrides: { diff --git a/apps/web/src/app/(default)/tastings/[tastingId]/page.tsx b/apps/web/src/app/(default)/tastings/[tastingId]/page.tsx index 0d9abc662..db6b6f7f5 100644 --- a/apps/web/src/app/(default)/tastings/[tastingId]/page.tsx +++ b/apps/web/src/app/(default)/tastings/[tastingId]/page.tsx @@ -2,11 +2,13 @@ import TastingComments from "@peated/web/components/tastingComments"; import TastingList from "@peated/web/components/tastingList"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; -export async function generateMetadata({ - params: { tastingId }, -}: { - params: { tastingId: string }; +export async function generateMetadata(props: { + params: Promise<{ tastingId: string }>; }) { + const params = await props.params; + + const { tastingId } = params; + const trpcClient = await getTrpcClient(); const tasting = await trpcClient.tastingById.fetch(Number(tastingId)); const title = `${tasting.bottle.fullName} - Tasting Notes by ${tasting.createdBy.username}`; @@ -33,11 +35,13 @@ export async function generateMetadata({ }; } -export default async function Page({ - params: { tastingId }, -}: { - params: { tastingId: string }; +export default async function Page(props: { + params: Promise<{ tastingId: string }>; }) { + const params = await props.params; + + const { tastingId } = params; + const trpcClient = await getTrpcClient(); const tasting = await trpcClient.tastingById.fetch(Number(tastingId)); diff --git a/apps/web/src/app/(default)/users/[username]/(tabs)/favorites/page.tsx b/apps/web/src/app/(default)/users/[username]/(tabs)/favorites/page.tsx index 63357515f..9b2a1062e 100644 --- a/apps/web/src/app/(default)/users/[username]/(tabs)/favorites/page.tsx +++ b/apps/web/src/app/(default)/users/[username]/(tabs)/favorites/page.tsx @@ -2,11 +2,13 @@ import BottleTable from "@peated/web/components/bottleTable"; import EmptyActivity from "@peated/web/components/emptyActivity"; import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; -export async function generateMetadata({ - params: { username }, -}: { - params: { username: string }; +export async function generateMetadata(props: { + params: Promise<{ username: string }>; }) { + const params = await props.params; + + const { username } = params; + const trpcClient = await getTrpcClient(); const user = await trpcClient.userById.fetch(username); @@ -21,11 +23,13 @@ export async function generateMetadata({ }; } -export default async function UserFavorites({ - params: { username }, -}: { - params: { username: string }; +export default async function UserFavorites(props: { + params: Promise<{ username: string }>; }) { + const params = await props.params; + + const { username } = params; + const trpcClient = await getTrpcClient(); const favoriteList = await trpcClient.collectionBottleList.fetch({ user: username, diff --git a/apps/web/src/app/(default)/users/[username]/(tabs)/page.tsx b/apps/web/src/app/(default)/users/[username]/(tabs)/page.tsx index 1b1b2614e..81fd7cf18 100644 --- a/apps/web/src/app/(default)/users/[username]/(tabs)/page.tsx +++ b/apps/web/src/app/(default)/users/[username]/(tabs)/page.tsx @@ -4,11 +4,13 @@ import { getTrpcClient } from "@peated/web/lib/trpc/client.server"; export const fetchCache = "default-no-store"; -export async function generateMetadata({ - params: { username }, -}: { - params: { username: string }; +export async function generateMetadata(props: { + params: Promise<{ username: string }>; }) { + const params = await props.params; + + const { username } = params; + const trpcClient = await getTrpcClient(); const user = await trpcClient.userById.fetch(username); @@ -23,11 +25,13 @@ export async function generateMetadata({ }; } -export default async function UserTastings({ - params: { username }, -}: { - params: { username: string }; +export default async function UserTastings(props: { + params: Promise<{ username: string }>; }) { + const params = await props.params; + + const { username } = params; + const trpcClient = await getTrpcClient(); const user = await trpcClient.userById.fetch(username); const tastingList = await trpcClient.tastingList.fetch({ diff --git a/apps/web/src/app/(default)/users/[username]/layout.tsx b/apps/web/src/app/(default)/users/[username]/layout.tsx index 48981b568..07afea4e0 100644 --- a/apps/web/src/app/(default)/users/[username]/layout.tsx +++ b/apps/web/src/app/(default)/users/[username]/layout.tsx @@ -16,13 +16,16 @@ import { UserBadgeList } from "./userBadgeList"; export const fetchCache = "default-no-store"; -export default async function Layout({ - params: { username }, - children, -}: { - params: { username: string }; +export default async function Layout(props: { + params: Promise<{ username: string }>; children: ReactNode; }) { + const params = await props.params; + + const { username } = params; + + const { children } = props; + const trpcClient = await getTrpcClient(); const user = await trpcClient.userById.fetch(username); diff --git a/apps/web/src/app/(layout-free)/bottles/[bottleId]/addTasting/page.tsx b/apps/web/src/app/(layout-free)/bottles/[bottleId]/addTasting/page.tsx index 2fe730662..ceac448bd 100644 --- a/apps/web/src/app/(layout-free)/bottles/[bottleId]/addTasting/page.tsx +++ b/apps/web/src/app/(layout-free)/bottles/[bottleId]/addTasting/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import BadgeImage from "@peated/web/components/badgeImage"; import { useFlashMessages } from "@peated/web/components/flash"; @@ -11,11 +12,13 @@ import { logError } from "@peated/web/lib/log"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter, useSearchParams } from "next/navigation"; -export default function AddTasting({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export default function AddTasting(props: { + params: Promise<{ bottleId: string }>; }) { + const params = use(props.params); + + const { bottleId } = params; + useAuthRequired(); const router = useRouter(); diff --git a/apps/web/src/app/(layout-free)/bottles/[bottleId]/edit/page.tsx b/apps/web/src/app/(layout-free)/bottles/[bottleId]/edit/page.tsx index 496c72693..cf0154232 100644 --- a/apps/web/src/app/(layout-free)/bottles/[bottleId]/edit/page.tsx +++ b/apps/web/src/app/(layout-free)/bottles/[bottleId]/edit/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import BottleForm from "@peated/web/components/bottleForm"; import { useFlashMessages } from "@peated/web/components/flash"; @@ -9,11 +10,11 @@ import { logError } from "@peated/web/lib/log"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -export default function Page({ - params: { bottleId }, -}: { - params: { bottleId: string }; -}) { +export default function Page(props: { params: Promise<{ bottleId: string }> }) { + const params = use(props.params); + + const { bottleId } = params; + useModRequired(); const [bottle] = trpc.bottleById.useSuspenseQuery(Number(bottleId)); diff --git a/apps/web/src/app/(layout-free)/bottles/[bottleId]/merge/page.tsx b/apps/web/src/app/(layout-free)/bottles/[bottleId]/merge/page.tsx index b90a2de39..5be1a7743 100644 --- a/apps/web/src/app/(layout-free)/bottles/[bottleId]/merge/page.tsx +++ b/apps/web/src/app/(layout-free)/bottles/[bottleId]/merge/page.tsx @@ -14,18 +14,20 @@ import Layout from "@peated/web/components/layout"; import { useModRequired } from "@peated/web/hooks/useAuthRequired"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -import { useState } from "react"; +import { use, useState } from "react"; import type { SubmitHandler } from "react-hook-form"; import { Controller, useForm } from "react-hook-form"; import type { z } from "zod"; type FormSchemaType = z.infer; -export default function MergeBottle({ - params: { bottleId }, -}: { - params: { bottleId: string }; +export default function MergeBottle(props: { + params: Promise<{ bottleId: string }>; }) { + const params = use(props.params); + + const { bottleId } = params; + useModRequired(); const [bottle] = trpc.bottleById.useSuspenseQuery(Number(bottleId)); diff --git a/apps/web/src/app/(layout-free)/entities/[entityId]/edit/page.tsx b/apps/web/src/app/(layout-free)/entities/[entityId]/edit/page.tsx index c0f2f35a9..86c756d1c 100644 --- a/apps/web/src/app/(layout-free)/entities/[entityId]/edit/page.tsx +++ b/apps/web/src/app/(layout-free)/entities/[entityId]/edit/page.tsx @@ -1,15 +1,16 @@ "use client"; +import { use } from "react"; import EntityForm from "@peated/web/components/entityForm"; import { useModRequired } from "@peated/web/hooks/useAuthRequired"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -export default function Page({ - params: { entityId }, -}: { - params: { entityId: string }; -}) { +export default function Page(props: { params: Promise<{ entityId: string }> }) { + const params = use(props.params); + + const { entityId } = params; + useModRequired(); const [entity] = trpc.entityById.useSuspenseQuery(Number(entityId)); diff --git a/apps/web/src/app/(layout-free)/entities/[entityId]/merge/page.tsx b/apps/web/src/app/(layout-free)/entities/[entityId]/merge/page.tsx index 4e600e06f..c259152ed 100644 --- a/apps/web/src/app/(layout-free)/entities/[entityId]/merge/page.tsx +++ b/apps/web/src/app/(layout-free)/entities/[entityId]/merge/page.tsx @@ -14,18 +14,18 @@ import Layout from "@peated/web/components/layout"; import { useModRequired } from "@peated/web/hooks/useAuthRequired"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -import { useState } from "react"; +import { use, useState } from "react"; import type { SubmitHandler } from "react-hook-form"; import { Controller, useForm } from "react-hook-form"; import type { z } from "zod"; type FormSchemaType = z.infer; -export default function Page({ - params: { entityId }, -}: { - params: { entityId: string }; -}) { +export default function Page(props: { params: Promise<{ entityId: string }> }) { + const params = use(props.params); + + const { entityId } = params; + useModRequired(); const [entity] = trpc.entityById.useSuspenseQuery(Number(entityId)); diff --git a/apps/web/src/app/(layout-free)/flights/[flightId]/edit/page.tsx b/apps/web/src/app/(layout-free)/flights/[flightId]/edit/page.tsx index 8589baf6f..1ba2d6621 100644 --- a/apps/web/src/app/(layout-free)/flights/[flightId]/edit/page.tsx +++ b/apps/web/src/app/(layout-free)/flights/[flightId]/edit/page.tsx @@ -1,14 +1,15 @@ "use client"; +import { use } from "react"; import FlightForm from "@peated/web/components/flightForm"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter } from "next/navigation"; -export default function Page({ - params: { flightId }, -}: { - params: { flightId: string }; -}) { +export default function Page(props: { params: Promise<{ flightId: string }> }) { + const params = use(props.params); + + const { flightId } = params; + const [[flight, bottles]] = trpc.useSuspenseQueries((t) => [ t.flightById(flightId), t.bottleList({ diff --git a/apps/web/src/app/(layout-free)/flights/[flightId]/overlay/page.tsx b/apps/web/src/app/(layout-free)/flights/[flightId]/overlay/page.tsx index 316b8b35e..d132246ce 100644 --- a/apps/web/src/app/(layout-free)/flights/[flightId]/overlay/page.tsx +++ b/apps/web/src/app/(layout-free)/flights/[flightId]/overlay/page.tsx @@ -1,15 +1,16 @@ "use client"; +import { use } from "react"; import BottleLink from "@peated/web/components/bottleLink"; import { Distillers } from "@peated/web/components/bottleMetadata"; import LayoutEmpty from "@peated/web/components/layoutEmpty"; import { trpc } from "@peated/web/lib/trpc/client"; -export default function Page({ - params: { flightId }, -}: { - params: { flightId: string }; -}) { +export default function Page(props: { params: Promise<{ flightId: string }> }) { + const params = use(props.params); + + const { flightId } = params; + const [[flight, bottles]] = trpc.useSuspenseQueries((t) => [ t.flightById(flightId), t.bottleList({ diff --git a/apps/web/src/app/(layout-free)/search/page.tsx b/apps/web/src/app/(layout-free)/search/page.tsx index 6634ea5b6..4d6fe96ef 100644 --- a/apps/web/src/app/(layout-free)/search/page.tsx +++ b/apps/web/src/app/(layout-free)/search/page.tsx @@ -5,11 +5,10 @@ export const metadata: Metadata = { title: "Search", }; -export default function Page({ - searchParams, -}: { - searchParams: Record; +export default async function Page(props: { + searchParams: Promise>; }) { + const searchParams = await props.searchParams; const query = searchParams.q ?? ""; return ; diff --git a/apps/web/src/app/(layout-free)/tastings/[tastingId]/edit/page.tsx b/apps/web/src/app/(layout-free)/tastings/[tastingId]/edit/page.tsx index 0e9ad4a43..010f0ba9c 100644 --- a/apps/web/src/app/(layout-free)/tastings/[tastingId]/edit/page.tsx +++ b/apps/web/src/app/(layout-free)/tastings/[tastingId]/edit/page.tsx @@ -1,4 +1,5 @@ "use client"; +import { use } from "react"; import { useFlashMessages } from "@peated/web/components/flash"; import TastingForm from "@peated/web/components/tastingForm"; @@ -9,11 +10,13 @@ import { logError } from "@peated/web/lib/log"; import { trpc } from "@peated/web/lib/trpc/client"; import { useRouter, useSearchParams } from "next/navigation"; -export default function Page({ - params: { tastingId }, -}: { - params: { tastingId: string }; +export default function Page(props: { + params: Promise<{ tastingId: string }>; }) { + const params = use(props.params); + + const { tastingId } = params; + useAuthRequired(); const [tasting] = trpc.tastingById.useSuspenseQuery(Number(tastingId)); diff --git a/apps/web/src/app/password-reset/page.tsx b/apps/web/src/app/password-reset/page.tsx index f27bad4b8..885339861 100644 --- a/apps/web/src/app/password-reset/page.tsx +++ b/apps/web/src/app/password-reset/page.tsx @@ -7,11 +7,10 @@ export const metadata: Metadata = { title: "Password Reset", }; -export default function PasswordReset({ - searchParams, -}: { - searchParams: Record; +export default async function PasswordReset(props: { + searchParams: Promise>; }) { + const searchParams = await props.searchParams; const token = searchParams.token; return ( diff --git a/apps/web/src/app/sitemaps/bottles/[id]/sitemap.xml/route.ts b/apps/web/src/app/sitemaps/bottles/[id]/sitemap.xml/route.ts index a459ad28c..4d84e27dc 100644 --- a/apps/web/src/app/sitemaps/bottles/[id]/sitemap.xml/route.ts +++ b/apps/web/src/app/sitemaps/bottles/[id]/sitemap.xml/route.ts @@ -9,8 +9,12 @@ const PAGE_LIMIT = 1000; export async function GET( request: Request, - { params: { id } }: { params: { id: string } }, + props: { params: Promise<{ id: string }> }, ) { + const params = await props.params; + + const { id } = params; + const startCursor = (Number(id) - 1) * (PAGE_LIMIT / 100) + 1; const trpcClient = await getTrpcClient(); diff --git a/apps/web/src/app/sitemaps/entities/[id]/sitemap.xml/route.ts b/apps/web/src/app/sitemaps/entities/[id]/sitemap.xml/route.ts index 1db01db3d..2c9d4292a 100644 --- a/apps/web/src/app/sitemaps/entities/[id]/sitemap.xml/route.ts +++ b/apps/web/src/app/sitemaps/entities/[id]/sitemap.xml/route.ts @@ -9,8 +9,12 @@ const PAGE_LIMIT = 1000; export async function GET( request: Request, - { params: { id } }: { params: { id: string } }, + props: { params: Promise<{ id: string }> }, ) { + const params = await props.params; + + const { id } = params; + const trpcClient = await getTrpcClient(); let cursor: number | null = (Number(id) - 1) * (PAGE_LIMIT / 100) + 1; diff --git a/apps/web/src/lib/session.server.ts b/apps/web/src/lib/session.server.ts index 154840a20..1275150e2 100644 --- a/apps/web/src/lib/session.server.ts +++ b/apps/web/src/lib/session.server.ts @@ -32,5 +32,5 @@ export const sessionOptions: SessionOptions = { }; export async function getSession() { - return await getIronSession(cookies(), sessionOptions); + return await getIronSession(await cookies(), sessionOptions); }