Skip to content

Commit 1dfbb35

Browse files
committed
chore: upgrade app-router to next 15
1 parent 516b987 commit 1dfbb35

File tree

9 files changed

+495
-98
lines changed

9 files changed

+495
-98
lines changed

examples/app-router/app/albums/@modal/(.)[album]/[song]/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { getSong } from "@example/shared/api";
22
import Modal from "@example/shared/components/Modal";
33

44
type Props = {
5-
params: {
5+
params: Promise<{
66
album: string;
77
song: string;
8-
};
8+
}>;
99
};
10-
export default async function SongPage({ params }: Props) {
10+
export default async function SongPage(props: Props) {
11+
const params = await props.params;
1112
const song = await getSong(params.album, params.song);
1213
return (
1314
<Modal>
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import Modal from "@example/shared/components/Modal";
22

33
type Props = {
4-
params: {
4+
params: Promise<{
55
artist: string;
6-
};
6+
}>;
77
};
8-
export default function ArtistPage({ params }: Props) {
8+
export default async function ArtistPage(props: Props) {
9+
const params = await props.params;
910
return <Modal>Artists {params.artist}</Modal>;
1011
}

examples/app-router/app/albums/[album]/[song]/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { getSong } from "@example/shared/api";
22

33
type Props = {
4-
params: {
4+
params: Promise<{
55
album: string;
66
song: string;
7-
};
7+
}>;
88
};
9-
export default async function Song({ params }: Props) {
9+
export default async function Song(props: Props) {
10+
const params = await props.params;
1011
const song = await getSong(params.album, params.song);
1112

1213
return (

examples/app-router/app/headers/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { headers } from "next/headers";
22

3-
export default function Headers() {
4-
const middlewareHeader = headers().get("request-header");
3+
export default async function Headers() {
4+
const middlewareHeader = (await headers()).get("request-header");
55
return (
66
<div>
77
<h1>Headers</h1>

examples/app-router/app/search-query/page.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { headers } from "next/headers";
22

3-
export default function SearchQuery({
4-
searchParams: propsSearchParams,
5-
}: {
6-
searchParams: Record<string, string | string[]>;
3+
export default async function SearchQuery(props: {
4+
searchParams: Promise<Record<string, string | string[]>>;
75
}) {
8-
const mwSearchParams = headers().get("search-params");
6+
const propsSearchParams = await props.searchParams;
7+
const mwSearchParams = (await headers()).get("search-params");
98
const multiValueParams = propsSearchParams["multi"];
109
const multiValueArray = Array.isArray(multiValueParams)
1110
? multiValueParams

examples/app-router/app/ssr/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async function getTime() {
1313

1414
export default async function SSR() {
1515
const time = await getTime();
16-
const headerList = headers();
16+
const headerList = await headers();
1717
return (
1818
<div>
1919
<h1>Time: {time}</h1>

examples/app-router/next.config.js renamed to examples/app-router/next.config.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
34
poweredByHeader: false,
45
cleanDistDir: true,
56
transpilePackages: ["@example/shared"],
67
output: "standalone",
7-
outputFileTracing: "../sst",
8-
experimental: {
9-
serverActions: true,
10-
},
8+
outputFileTracingRoot: "../sst",
119
eslint: {
1210
ignoreDuringBuilds: true,
1311
},
@@ -19,7 +17,7 @@ const nextConfig = {
1917
},
2018
],
2119
},
22-
redirects: () => {
20+
redirects: async () => {
2321
return [
2422
{
2523
source: "/next-config-redirect-missing",
@@ -60,7 +58,7 @@ const nextConfig = {
6058
},
6159
];
6260
},
63-
headers() {
61+
async headers() {
6462
return [
6563
{
6664
source: "/(.*)",
@@ -75,4 +73,4 @@ const nextConfig = {
7573
},
7674
};
7775

78-
module.exports = nextConfig;
76+
export default nextConfig;

examples/app-router/package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,24 @@
1313
"dependencies": {
1414
"@example/shared": "workspace:*",
1515
"@open-next/utils": "workspace:*",
16-
"next": "^14.1.4",
16+
"next": "15.0.0",
1717
"@opennextjs/aws": "workspace:*",
18-
"react": "latest",
19-
"react-dom": "latest"
18+
"react": "19.0.0-rc-65a56d0e-20241020",
19+
"react-dom": "19.0.0-rc-65a56d0e-20241020"
2020
},
2121
"devDependencies": {
2222
"@types/node": "20.5.0",
23-
"@types/react": "18.2.20",
24-
"@types/react-dom": "18.2.7",
23+
"@types/react": "npm:types-react@19.0.0-rc.1",
24+
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
2525
"autoprefixer": "10.4.15",
2626
"postcss": "8.4.27",
2727
"tailwindcss": "3.3.3",
2828
"typescript": "^4.9.3"
29+
},
30+
"pnpm": {
31+
"overrides": {
32+
"@types/react": "npm:types-react@19.0.0-rc.1",
33+
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
34+
}
2935
}
3036
}

0 commit comments

Comments
 (0)