Unverified Commit 82750786 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

test: fix async api tests (#71652)

parent 95720f4c
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>
......
......@@ -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 />
}
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 />
}
......@@ -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}>
......
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 (
<>
......
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>
......
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>
......
......@@ -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
......
export const dynamicParams = false
export default function Page({ params }) {
export default async function Page() {
return <p>Static page</p>
}
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>
......
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>
......
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>
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment