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

test: fix async api tests #71652

Merged
merged 1 commit into from
Oct 22, 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Link from 'next/link'

export default function Layout({ children, modal, params }) {
export default async function Layout(props) {
const params = await props.params

const { children, modal } = props

return (
<>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import ClientComp from './client-component'
import { headers } from 'next/headers'

export default function Page() {
export default async function Page() {
// Opt-in to SSR.
headers()
await headers()
return <ClientComp />
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ClientComp from './client-component'
import { headers } from 'next/headers'

export default function Page() {
export default async function Page() {
// Opt-in to SSR.
headers()
await headers()
return <ClientComp />
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default async function Page({ params }) {
const { artist, album } = await params
return (
<div>
<h2>Album: {params.album}</h2>
<h2>Album: {album}</h2>
<ul>
{tracks.map((track) => (
<li key={track}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link'

export default function Page({ params }) {
export default async function Page(props) {
const params = await props.params
const nextUrl = [...params.slug, 'slug']
return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link'

export default function Page({ params }) {
export default async function Page(props) {
const params = await props.params
return (
<>
<Link href="/basic-route/inner">To basic inner</Link>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link'

export default function Page({ params }) {
export default async function Page(props) {
const params = await props.params
return (
<>
<Link href="/dynamic/first/second">To inner dynamic</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Link from 'next/link'

export const dynamicParams = false

export default function Page({ params }) {
export default async function Page(props) {
const params = await props.params
return (
<>
<Link
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const dynamicParams = false

export default function Page({ params }) {
export default async function Page() {
return <p>Static page</p>
}
3 changes: 2 additions & 1 deletion test/e2e/app-dir/searchparams-reuse-loading/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link'

export default function Page({ searchParams }) {
export default async function Page(props) {
const searchParams = await props.searchParams
return (
<>
<div id="root-params">{JSON.stringify(searchParams)}</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link'

export default async function Home({ searchParams }) {
export default async function Home(props) {
const searchParams = await props.searchParams
return (
<div>
<h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link'

export default async function Home({ searchParams }) {
export default async function Home(props) {
const searchParams = await props.searchParams
return (
<div>
<h1>
Expand Down
3 changes: 2 additions & 1 deletion test/integration/app-dir-export/app/another/[slug]/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export function generateStaticParams() {
return [{ slug: 'first' }, { slug: 'second' }]
}

export default function Page({ params }) {
export default async function Page(props) {
const params = await props.params
return (
<main>
<h1>{params.slug}</h1>
Expand Down
Loading