Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: await dynamic APIs #378

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"gray-matter": "^4.0.3",
"instantsearch.js": "^4.72.2",
"lexical": "0.17.0",
"next": "15.0.0-canary.162",
"next": "15.0.0-canary.173",
"next-mdx-remote": "^5.0.0",
"next-sitemap": "^4.0.6",
"node-cron": "^3.0.3",
Expand All @@ -84,10 +84,10 @@
"payload-admin-bar": "^1.0.6",
"prism-react-renderer": "^2.3.1",
"qs-esm": "7.0.2",
"react": "19.0.0-rc-e4953922-20240919",
"react": "19.0.0-rc-3edc000d-20240926",
"react-animate-height": "^3.0.4",
"react-cookie": "^4.1.1",
"react-dom": "19.0.0-rc-e4953922-20240919",
"react-dom": "19.0.0-rc-3edc000d-20240926",
"react-facebook-pixel": "^1.0.4",
"react-fast-marquee": "^1.5.2",
"react-instantsearch": "^7.11.4",
Expand Down
772 changes: 386 additions & 386 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2,028 changes: 1,014 additions & 1,014 deletions public/sitemap-0.xml

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions src/app/(frontend)/(cloud)/cloud/[team-slug]/(tabs)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import { Metadata } from 'next'
import { mergeOpenGraph } from '@root/seo/mergeOpenGraph.js'
import { TeamPage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
}>
}) => {
const { 'team-slug': teamSlug } = await params
const team = await fetchTeamWithCustomer(teamSlug)
const projectsRes = await fetchProjects([team?.id])

Expand All @@ -15,7 +22,14 @@ export default async ({ params: { 'team-slug': teamSlug } }) => {
return <TeamPage team={team} initialState={projectsRes} templates={templates} />
}

export async function generateMetadata({ params: { 'team-slug': teamSlug } }): Promise<Metadata> {
export async function generateMetadata({
params,
}: {
params: Promise<{
'team-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug } = await params
return {
title: `${teamSlug} - Team Projects`,
openGraph: mergeOpenGraph({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ import { checkTeamRoles } from '@root/utilities/check-team-roles.js'

import classes from './page.module.scss'

export default async ({ params: { 'team-slug': teamSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
}>
}) => {
const { 'team-slug': teamSlug } = await params
const { user } = await fetchMe()
const team = await fetchTeamWithCustomer(teamSlug)

Expand Down Expand Up @@ -66,7 +73,14 @@ export default async ({ params: { 'team-slug': teamSlug } }) => {
)
}

export async function generateMetadata({ params: { 'team-slug': teamSlug } }): Promise<Metadata> {
export async function generateMetadata({
params,
}: {
params: Promise<{
'team-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug } = await params
return {
title: `${teamSlug} - Team Billing`,
openGraph: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ import { Metadata } from 'next'
import { Message } from '@components/Message/index.js'
import { TeamInvoicesPage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
}>
}) => {
const { 'team-slug': teamSlug } = await params
const { user } = await fetchMe()
const team = await fetchTeamWithCustomer(teamSlug)
const invoices = await fetchInvoices(team)
Expand All @@ -26,7 +33,14 @@ export default async ({ params: { 'team-slug': teamSlug } }) => {
)
}

export async function generateMetadata({ params: { 'team-slug': teamSlug } }): Promise<Metadata> {
export async function generateMetadata({
params,
}: {
params: Promise<{
'team-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug } = await params
return {
title: `${teamSlug} - Team Invoices`,
openGraph: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@ import { Metadata } from 'next'

import { TeamMembersPage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
}>
}) => {
const { 'team-slug': teamSlug } = await params
const team = await fetchTeamWithCustomer(teamSlug)
return <TeamMembersPage team={team} />
}

export async function generateMetadata({ params: { 'team-slug': teamSlug } }): Promise<Metadata> {
export async function generateMetadata({
params,
}: {
params: Promise<{
'team-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug } = await params
return {
title: `${teamSlug} - Team Members`,
openGraph: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ import { Metadata } from 'next'
import { Message } from '@components/Message/index.js'
import { TeamSubscriptionsPage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
}>
}) => {
const { 'team-slug': teamSlug } = await params
const { user } = await fetchMe()
const team = await fetchTeamWithCustomer(teamSlug)
const plans = await fetchPlans()
Expand All @@ -28,7 +35,14 @@ export default async ({ params: { 'team-slug': teamSlug } }) => {
)
}

export async function generateMetadata({ params: { 'team-slug': teamSlug } }): Promise<Metadata> {
export async function generateMetadata({
params,
}: {
params: Promise<{
'team-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug } = await params
return {
title: `${teamSlug} - Team Subscriptions`,
openGraph: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import * as React from 'react'
import { fetchTeamWithCustomer } from '@cloud/_api/fetchTeam.js'
import { Sidebar } from '@cloud/_components/Sidebar/index.js'
import { cloudSlug } from '@cloud/slug.js'

import { Gutter } from '@components/Gutter/index.js'
import { TeamBillingMessages } from './TeamBillingMessages/index.js'
import * as React from 'react'

import { TeamBillingMessages } from './TeamBillingMessages/index.js'
import classes from './layout.module.scss'

export default async ({ params: { 'team-slug': teamSlug }, children }) => {
export default async ({
children,
params,
}: {
children: React.ReactNode
params: Promise<{
'team-slug': string
}>
}) => {
const { 'team-slug': teamSlug } = await params
// Note: this fetch will get deduped by the page
// each page within this layout calls this same function
// Next.js will only call it once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,26 @@ import { Metadata } from 'next'
import { mergeOpenGraph } from '@root/seo/mergeOpenGraph.js'
import { TeamSettingsPage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
}>
}) => {
const { 'team-slug': teamSlug } = await params
const team = await fetchTeamWithCustomer(teamSlug)
return <TeamSettingsPage team={team} />
}

export async function generateMetadata({ params: { 'team-slug': teamSlug } }): Promise<Metadata> {
export async function generateMetadata({
params,
}: {
params: Promise<{
'team-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug } = await params
return {
title: `${teamSlug} - Team Settings`,
openGraph: mergeOpenGraph({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ import { Metadata } from 'next'
import { InfraOffline } from './InfraOffline/index.js'
import { InfraOnline } from './InfraOnline/index.js'

export default async ({ params: { 'team-slug': teamSlug, 'project-slug': projectSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}) => {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
const { team, project } = await fetchProjectAndRedirect({ teamSlug, projectSlug })

if (project?.infraStatus === 'done') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { Metadata } from 'next'

import { ProjectDatabasePage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug, 'project-slug': projectSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}) => {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
const { team, project } = await fetchProjectAndRedirect({ teamSlug, projectSlug })

return <ProjectDatabasePage project={project} team={team} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { Metadata } from 'next'

import { ProjectFileStoragePage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug, 'project-slug': projectSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}) => {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
const { team, project } = await fetchProjectAndRedirect({ teamSlug, projectSlug })
return <ProjectFileStoragePage project={project} team={team} />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ export default async props => {
}

export async function generateMetadata({
params: { 'team-slug': teamSlug, 'project-slug': projectSlug },
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
return {
title: {
template: `${teamSlug} / ${projectSlug} | %s`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ import { Metadata } from 'next'

import { ProjectLogsPage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug, 'project-slug': projectSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}) => {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
const { team, project } = await fetchProjectAndRedirect({ teamSlug, projectSlug })
return <ProjectLogsPage project={project} team={team} />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,28 @@ import { Metadata } from 'next'
import { mergeOpenGraph } from '@root/seo/mergeOpenGraph.js'
import { ProjectBuildSettingsPage } from './page_client.js'

export default async ({ params: { 'team-slug': teamSlug, 'project-slug': projectSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}) => {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
const { team, project } = await fetchProjectAndRedirect({ teamSlug, projectSlug })
return <ProjectBuildSettingsPage project={project} team={team} />
}

export async function generateMetadata({
params: { 'team-slug': teamSlug, 'project-slug': projectSlug },
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
return {
title: 'Build Settings',
openGraph: mergeOpenGraph({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ const statusLabels = {
unknown: 'Unknown',
}

export default async ({ params: { 'team-slug': teamSlug, 'project-slug': projectSlug } }) => {
export default async ({
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}) => {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
const { user } = await fetchMe()

const { team, project } = await fetchProjectAndRedirect({ teamSlug, projectSlug })
Expand Down Expand Up @@ -115,8 +123,14 @@ export default async ({ params: { 'team-slug': teamSlug, 'project-slug': project
}

export async function generateMetadata({
params: { 'team-slug': teamSlug, 'project-slug': projectSlug },
params,
}: {
params: Promise<{
'team-slug': string
'project-slug': string
}>
}): Promise<Metadata> {
const { 'team-slug': teamSlug, 'project-slug': projectSlug } = await params
return {
title: 'Billing',
openGraph: mergeOpenGraph({
Expand Down
Loading