Skip to content

Commit 1ca7e56

Browse files
chore(deps): update nextjs monorepo to v15 (major) (#270)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Yuta Hiroto <[email protected]>
1 parent 1345f04 commit 1ca7e56

File tree

42 files changed

+456
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+456
-180
lines changed

next.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const nextConfig = {
88
transpilePackages: ["shiki"],
99
experimental: {
1010
taint: true,
11+
// typedRoutes: true,
1112
},
1213
async redirects() {
1314
return [

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"check": "biome check --apply ."
1616
},
1717
"dependencies": {
18-
"@next/third-parties": "^14.2.16",
18+
"@next/third-parties": "^15.0.1",
1919
"@shikijs/transformers": "^1.22.2",
2020
"algoliasearch": "^4.24.0",
2121
"instantsearch.js": "^4.75.3",
22-
"next": "14.2.16",
22+
"next": "15.0.1",
2323
"react": "^18.3.1",
2424
"react-dom": "^18.3.1",
2525
"react-instantsearch": "^7.13.6",

pnpm-lock.yaml

+336-81
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/_components/fileTree.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function FileTree({ exampleName, filePaths, code, isIframe }: Props) {
4444
const initialCandidate = `${exampleName}/page.tsx`;
4545
const initialPath =
4646
filePathFromParams ??
47-
(paths.includes(initialCandidate) ? initialCandidate : paths[0] ?? "");
47+
(paths.includes(initialCandidate) ? initialCandidate : (paths[0] ?? ""));
4848
const [selectedPath, setSelectedPath] = useState(initialPath);
4949
const tree = createTree(paths);
5050

src/app/_components/link.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import NextLink, { type LinkProps } from "next/link";
22
import type { PropsWithChildren } from "react";
33

4-
type Props = PropsWithChildren<LinkProps>;
4+
type Props = PropsWithChildren<LinkProps<unknown>>;
55

66
export function Link({ children, ...rest }: Props) {
77
return (

src/app/examples/(caching)/router-cache/[id]/page.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { notFound } from "next/navigation";
44
import { TITLES } from "../constants";
55

66
type Props = {
7-
params: {
7+
params: Promise<{
88
id: string;
9-
};
9+
}>;
1010
};
1111

12-
export default function Page({ params }: Props) {
13-
const title = TITLES[Number(params.id)];
12+
export default async function Page({ params }: Props) {
13+
const { id } = await params;
14+
const title = TITLES[Number(id)];
1415

1516
if (!title) {
1617
return notFound();

src/app/examples/(dynamic-routes)/dynamic-optional-multiple/[[...slug]]/page.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { Link } from "@/app/_components/link";
22

33
type Props = {
4-
params: {
4+
params: Promise<{
55
slug: string[];
6-
};
6+
}>;
77
};
88

9-
export default function Page({ params }: Props) {
9+
export default async function Page({ params }: Props) {
10+
const { slug } = await params;
11+
1012
return (
1113
<div className="flex flex-col gap-4">
12-
<span>slug: {JSON.stringify(params.slug)}</span>
14+
<span>slug: {JSON.stringify(slug)}</span>
1315
<Link href="/examples/dynamic-optional-multiple/one">
1416
👍 /dynamic-optional-multiple/one
1517
</Link>

src/app/examples/(dynamic-routes)/dynamic-required-multiple/[...slug]/page.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { Link } from "@/app/_components/link";
22

33
type Props = {
4-
params: {
4+
params: Promise<{
55
slug: string[];
6-
};
6+
}>;
77
};
88

9-
export default function Page({ params }: Props) {
9+
export default async function Page({ params }: Props) {
10+
const { slug } = await params;
11+
1012
return (
1113
<div className="flex flex-col gap-4">
12-
<span>slug: {JSON.stringify(params.slug)}</span>
14+
<span>slug: {JSON.stringify(slug)}</span>
1315
<Link href="/examples/dynamic-required-multiple/one">
1416
👍 /dynamic-required-multiple/one
1517
</Link>
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
type Props = {
2-
params: {
2+
params: Promise<{
33
slug: string;
4-
};
4+
}>;
55
};
66

7-
export default function Page({ params }: Props) {
8-
return <span>slug: {params.slug}</span>;
7+
export default async function Page({ params }: Props) {
8+
const { slug } = await params;
9+
10+
return <span>slug: {slug}</span>;
911
}

src/app/examples/(metadata)/generating-opengraph-image/[slug]/opengraph-image.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ export const size = {
88
export const contentType = "image/png";
99

1010
type Props = {
11-
params: {
11+
params: Promise<{
1212
slug: string;
13-
};
13+
}>;
1414
};
1515

1616
export default async function Image({ params }: Props) {
17+
const { slug } = await params;
18+
1719
return new ImageResponse(
1820
<div
1921
style={{
@@ -26,7 +28,7 @@ export default async function Image({ params }: Props) {
2628
justifyContent: "center",
2729
}}
2830
>
29-
{alt} {params.slug}
31+
{alt} {slug}
3032
</div>,
3133
);
3234
}

src/app/examples/(metadata)/generating-opengraph-image/[slug]/page.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import { MetaList } from "../../_components/metaList";
55
const path = "generating-opengraph-image/foo";
66

77
type Props = {
8-
params: {
8+
params: Promise<{
99
slug: string;
10-
};
10+
}>;
1111
};
1212

13-
export default function Page({ params }: Props) {
14-
if (params.slug !== "foo") {
13+
export default async function Page({ params }: Props) {
14+
const { slug } = await params;
15+
16+
if (slug !== "foo") {
1517
return notFound();
1618
}
1719

src/app/examples/(metadata)/generating-opengraph-image/opengraph-image.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ export const size = {
88
export const contentType = "image/png";
99

1010
export default async function Image() {
11-
// when you want to return an image when only bots
12-
// const { isBot } = userAgent({ headers: headers() });
13-
1411
return new ImageResponse(
1512
<div
1613
style={{

src/app/examples/(metadata)/overwriting-meta/dynamic/page.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { MetaList } from "../../_components/metaList";
66
const path = "overwriting-meta/dynamic";
77

88
type Params = {
9-
params: { id: string };
10-
searchParams: Record<string, string | string[] | undefined>;
9+
params: Promise<{
10+
id: string;
11+
}>;
12+
searchParams: Promise<Record<string, string | string[] | undefined>>;
1113
};
1214

1315
export async function generateMetadata(

src/app/examples/(parallel-routes)/parallel-condition/@dashboard/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function Page() {
88
async function logOut() {
99
"use server";
1010

11-
cookies().delete(COOKIE_NAME);
11+
(await cookies()).delete(COOKIE_NAME);
1212
}
1313

1414
return (

src/app/examples/(parallel-routes)/parallel-condition/@login/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function Page() {
88
async function login() {
99
"use server";
1010

11-
cookies().set(COOKIE_NAME, "true");
11+
(await cookies()).set(COOKIE_NAME, "true");
1212
}
1313

1414
return (

src/app/examples/(parallel-routes)/parallel-condition/layout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ type Props = PropsWithChildren<{
88
login: React.ReactNode;
99
}>;
1010

11-
export default function Layout({ dashboard, login, children }: Props) {
12-
const isLoggedIn = cookies().get(COOKIE_NAME)?.value === "true";
11+
export default async function Layout({ dashboard, login, children }: Props) {
12+
const isLoggedIn = (await cookies()).get(COOKIE_NAME)?.value === "true";
1313

1414
return (
1515
<Boundary label="Layout" filePath="layout.tsx">

src/app/examples/(rendering)/server-components/_components/dynamic.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { performance } from "node:perf_hooks";
22
import { Boundary } from "@/app/_components/boundary";
33
import { cookies, headers } from "next/headers";
44

5-
export function Dynamic() {
6-
const headersList = headers();
5+
export async function Dynamic() {
6+
const headersList = await headers();
77
// or
8-
const cookiesList = cookies();
8+
const cookiesList = await cookies();
99
// or
1010
// searchParams
1111

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import { type NextRequest, NextResponse } from "next/server";
22

3+
type Props = {
4+
params: Promise<{
5+
slug: string;
6+
}>
7+
}
8+
39
export async function GET(
410
req: NextRequest,
5-
{ params }: { params: { slug: string } },
11+
{ params }: Props,
612
) {
7-
return NextResponse.json({ msg: params.slug });
13+
const { slug } = await params;
14+
15+
return NextResponse.json({ msg: slug });
816
}

src/app/examples/(route-handlers)/route-handlers/api/dynamic/route.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import { type NextRequest, NextResponse } from "next/server";
44
const COOKIE_NAME = "example-route-handlers";
55

66
// when use headers or cookies or searchParams, this response will be dynamic
7-
export async function GET(req: NextRequest, res: NextResponse) {
8-
const referer = headers().get("referer");
9-
const cookie = cookies().get(COOKIE_NAME);
10-
11-
req.nextUrl.searchParams;
7+
export async function GET(req: NextRequest) {
8+
// const referer = (await headers()).get("referer");
9+
// const cookie = (await cookies()).get(COOKIE_NAME);
10+
// req.nextUrl.searchParams;
1211

1312
return NextResponse.json({ msg: Date.now() });
1413
}

src/app/examples/(route-handlers)/route-handlers/api/revalidate/route.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NowResponse } from "@/constants";
22
import { type NextRequest, NextResponse } from "next/server";
33

4-
export async function GET(req: NextRequest, res: NextResponse) {
4+
export async function GET(req: NextRequest) {
55
const { now }: NowResponse = await (
66
await fetch(`${process.env.NEXT_PUBLIC_EXTERNAL_URL}/api/now`, {
77
next: {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type NextRequest, NextResponse } from "next/server";
22

3-
export async function GET(req: NextRequest, res: NextResponse) {
3+
export async function GET(req: NextRequest) {
44
return NextResponse.json({ msg: Date.now() });
55
}

src/app/examples/(showcases)/shopping/(public)/@dialog/(.)foods/[itemId]/page.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ import { Suspense } from "react";
55
import { Dialog } from "../../_components/dialog";
66

77
type Props = {
8-
params: {
8+
params: Promise<{
99
itemId: string;
10-
};
10+
}>;
1111
};
1212

13-
export default function Page({ params }: Props) {
13+
export default async function Page({ params }: Props) {
14+
const { itemId } = await params;
15+
1416
return (
1517
<Dialog>
1618
<Suspense fallback={<Loading />}>
17-
<Main id={params.itemId} />
19+
<Main id={itemId} />
1820
</Suspense>
1921
</Dialog>
2022
);

src/app/examples/(showcases)/shopping/(public)/foods/[itemId]/page.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import { notFound } from "next/navigation";
22
import { getItem } from "../../../_utils/items";
33

44
type Props = {
5-
params: {
5+
params: Promise<{
66
itemId: string;
7-
};
7+
}>;
88
};
99

1010
export default async function Page({ params }: Props) {
11-
const item = await getItem(params.itemId);
11+
const { itemId } = await params;
12+
const item = await getItem(itemId);
1213

1314
if (item === undefined) {
1415
return notFound();

src/app/examples/(showcases)/shopping/actions.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ export async function signIn() {
1010
// e.g. simulate a request to the server
1111
await new Promise((resolve) => setTimeout(resolve, 1000));
1212

13-
cookies().set(COOKIE_NAME, "true");
13+
(await cookies()).set(COOKIE_NAME, "true");
1414
redirect("/examples/shopping");
1515
}
1616

1717
export async function signout() {
18-
cookies().delete(COOKIE_NAME);
18+
(await cookies()).delete(COOKIE_NAME);
1919
}
2020

2121
export async function isSignIn() {
22-
return cookies().get(COOKIE_NAME)?.value === "true";
22+
return (await cookies()).get(COOKIE_NAME)?.value === "true";
2323
}

0 commit comments

Comments
 (0)