Skip to content

Commit 891e7c2

Browse files
[docs] Upgrade to Next.js 15 (#762)
Co-authored-by: Michał Dudak <[email protected]>
1 parent 1fe1255 commit 891e7c2

File tree

17 files changed

+335
-358
lines changed

17 files changed

+335
-358
lines changed

.circleci/config.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ workflows:
385385
<<: *default-context
386386
- test_unit:
387387
<<: *default-context
388+
name: 'JSDOM tests'
388389
requires:
389390
- checkout
390391
- test_lint:
@@ -397,14 +398,17 @@ workflows:
397398
- checkout
398399
- test_types:
399400
<<: *default-context
401+
name: 'Typechecking'
400402
requires:
401403
- checkout
402404
- test_browser:
403405
<<: *default-context
406+
name: 'Browser tests'
404407
requires:
405408
- checkout
406409
- test_regressions:
407410
<<: *default-context
411+
name: 'Regression tests'
408412
requires:
409413
- checkout
410414
- test_e2e:
@@ -439,24 +443,26 @@ workflows:
439443
- test_regressions:
440444
<<: *default-context
441445
react-version: ^17.0.0
442-
react-next:
443-
triggers:
444-
- schedule:
445-
cron: '0 0 * * *'
446-
filters:
447-
branches:
448-
only:
449-
- master
446+
react-18:
447+
when:
448+
equal: [pipeline, << pipeline.parameters.workflow >>]
450449
jobs:
451450
- test_unit:
452451
<<: *default-context
453-
react-version: next
452+
name: 'JSDOM tests (React 18)'
453+
react-version: '^18'
454454
- test_browser:
455455
<<: *default-context
456-
react-version: next
456+
name: 'Browser tests (React 18)'
457+
react-version: '^18'
457458
- test_regressions:
458459
<<: *default-context
459-
react-version: next
460+
name: 'Regression tests (React 18)'
461+
react-version: '^18'
462+
- test_types:
463+
<<: *default-context
464+
name: 'Typechecking (React 18)'
465+
react-version: '^18'
460466
typescript-next:
461467
triggers:
462468
- schedule:
@@ -468,3 +474,4 @@ workflows:
468474
jobs:
469475
- test_types_next:
470476
<<: *default-context
477+
name: 'Typechecking (typescript@next)'

docs/config.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/next.config.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,16 @@ const nextConfig = {
7979
},
8080
distDir: 'export',
8181
transpilePackages: ['@mui/monorepo'],
82-
...(process.env.NODE_ENV === 'production'
83-
? {
84-
output: 'export',
85-
}
86-
: {}),
82+
...(process.env.NODE_ENV === 'production' ? { output: 'export' } : {}),
8783
experimental: {
8884
esmExternals: true,
8985
workerThreads: false,
9086
},
87+
devIndicators: {
88+
appIsrStatus: false,
89+
},
9190
};
9291

93-
export default withDocsInfra(withMdx(nextConfig));
92+
// Remove deprecated options that come from `withDocsInfra()` and cause warnings
93+
const { optimizeFonts, ...result } = withMdx(withDocsInfra(nextConfig));
94+
export default result;

docs/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@mdx-js/react": "^3.1.0",
2828
"@mui/system": "6.1.6",
2929
"@mui/utils": "6.1.6",
30-
"@next/mdx": "^14.2.13",
30+
"@next/mdx": "^15.0.1",
3131
"@react-spring/web": "^9.7.4",
3232
"@stefanprobst/rehype-extract-toc": "^2.2.0",
3333
"@types/mdx": "^2.0.13",
@@ -42,14 +42,14 @@
4242
"fast-glob": "^3.3.2",
4343
"lodash": "^4.17.21",
4444
"lz-string": "^1.5.0",
45-
"next": "^14.2.13",
45+
"next": "15.0.1",
4646
"postcss": "^8.4.47",
4747
"postcss-import": "^16.1.0",
4848
"prop-types": "^15.8.1",
49-
"react": "^18.3.1",
50-
"react-dom": "^18.3.1",
49+
"react": "19.0.0-rc-69d4b800-20241021",
50+
"react-dom": "19.0.0-rc-69d4b800-20241021",
5151
"react-error-boundary": "^4.0.13",
52-
"react-is": "^18.3.1",
52+
"react-is": "19.0.0-rc-69d4b800-20241021",
5353
"react-router-dom": "^6.23.1",
5454
"react-runner": "^1.0.5",
5555
"react-simple-code-editor": "^0.13.1",
@@ -75,8 +75,8 @@
7575
"@types/hast": "^3.0.4",
7676
"@types/node": "^18.19.54",
7777
"@types/prop-types": "^15.7.13",
78-
"@types/react": "^18.3.10",
79-
"@types/react-dom": "^18.3.0",
78+
"@types/react": "npm:[email protected]",
79+
"@types/react-dom": "npm:[email protected]",
8080
"@types/unist": "^3.0.3",
8181
"chai": "^4.5.0",
8282
"framer-motion": "^11.9.0",

docs/src/app/(content)/components/[slug]/page.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,17 @@ import { getApiReferenceData } from './getApiReferenceData';
2121
const CATEGORY_SEGMENT = 'components';
2222

2323
interface Props {
24-
params: {
24+
params: Promise<{
2525
slug: string;
26-
};
26+
}>;
2727
}
2828

2929
function componentNameFromSlug(slug: string) {
3030
return slug.replace('react-', '');
3131
}
3232

3333
export default async function ComponentPage(props: Props) {
34-
const {
35-
params: { slug },
36-
} = props;
37-
34+
const { slug } = await props.params;
3835
const componentName = componentNameFromSlug(slug);
3936

4037
const { MDXContent, metadata, tableOfContents } = await getMarkdownPage(
@@ -95,7 +92,8 @@ export async function generateStaticParams() {
9592
return getSlugs(`/${CATEGORY_SEGMENT}`).map((slug) => ({ slug }));
9693
}
9794

98-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
95+
export async function generateMetadata(props: Props): Promise<Metadata> {
96+
const params = await props.params;
9997
const { slug } = params;
10098
const componentName = componentNameFromSlug(slug);
10199
const { title = 'Components', description } = await getMarkdownPageMetadata(

docs/src/app/(content)/getting-started/[slug]/page.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ import { EditPageGithubLink } from 'docs/src/components/EditPageGithubLink';
1414
const CATEGORY_SEGMENT = 'getting-started';
1515

1616
interface Props {
17-
params: {
17+
params: Promise<{
1818
slug: string;
19-
};
19+
}>;
2020
}
2121

2222
export default async function DocsPage(props: Props) {
23-
const {
24-
params: { slug },
25-
} = props;
26-
23+
const { slug } = await props.params;
2724
const { MDXContent, tableOfContents, metadata } = await getMarkdownPage(
2825
CATEGORY_SEGMENT,
2926
slug,
@@ -62,7 +59,8 @@ export async function generateStaticParams() {
6259
return getSlugs(`/${CATEGORY_SEGMENT}`).map((slug) => ({ slug }));
6360
}
6461

65-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
62+
export async function generateMetadata(props: Props): Promise<Metadata> {
63+
const params = await props.params;
6664
const { slug } = params;
6765
const { title = 'Getting started', description } = await getMarkdownPageMetadata(
6866
CATEGORY_SEGMENT,

docs/src/app/(content)/guides/[slug]/page.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ import { EditPageGithubLink } from 'docs/src/components/EditPageGithubLink';
1414
const CATEGORY_SEGMENT = 'guides';
1515

1616
interface Props {
17-
params: {
17+
params: Promise<{
1818
slug: string;
19-
};
19+
}>;
2020
}
2121

2222
export default async function DocsPage(props: Props) {
23-
const {
24-
params: { slug },
25-
} = props;
26-
23+
const { slug } = await props.params;
2724
const { MDXContent, tableOfContents, metadata } = await getMarkdownPage(
2825
CATEGORY_SEGMENT,
2926
slug,
@@ -62,7 +59,8 @@ export async function generateStaticParams() {
6259
return getSlugs(`/${CATEGORY_SEGMENT}`).map((slug) => ({ slug }));
6360
}
6461

65-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
62+
export async function generateMetadata(props: Props): Promise<Metadata> {
63+
const params = await props.params;
6664
const { slug } = params;
6765
const { title = 'Guides', description } = await getMarkdownPageMetadata(
6866
CATEGORY_SEGMENT,

docs/src/app/experiments/[slug]/page.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ import { readdir } from 'node:fs/promises';
77
import '../../../styles/style.css';
88

99
interface Props {
10-
params: {
10+
params: Promise<{
1111
slug: string;
12-
};
12+
}>;
1313
}
1414

1515
export default async function Page(props: Props) {
16-
const {
17-
params: { slug },
18-
} = props;
16+
const { slug } = await props.params;
1917

2018
try {
2119
const Experiment = (await import(`../${slug}.tsx`)).default;
@@ -37,7 +35,8 @@ export async function generateStaticParams() {
3735
.map((entry: Dirent) => ({ slug: basename(entry.name, extname(entry.name)) }));
3836
}
3937

40-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
38+
export async function generateMetadata(props: Props): Promise<Metadata> {
39+
const params = await props.params;
4140
const { slug } = params;
4241

4342
return {

docs/src/app/playground/[slug]/page.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ import { readdir } from 'node:fs/promises';
77
import '../../../styles/style.css';
88

99
interface Props {
10-
params: {
10+
params: Promise<{
1111
slug: string;
12-
};
12+
}>;
1313
}
1414

1515
const DUMMY_SLUG = '_';
1616

1717
export default async function Page(props: Props) {
18-
const {
19-
params: { slug },
20-
} = props;
18+
const { slug } = await props.params;
2119

2220
if (slug === DUMMY_SLUG) {
2321
notFound();
@@ -46,7 +44,8 @@ export async function generateStaticParams() {
4644
return routes;
4745
}
4846

49-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
47+
export async function generateMetadata(props: Props): Promise<Metadata> {
48+
const params = await props.params;
5049
const { slug } = params;
5150

5251
return {

docs/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"next-env.d.ts",
99
"next.config.mjs",
1010
".next/types/**/*.ts",
11-
"export/types/**/*.ts",
12-
"config.ts"
11+
"export/types/**/*.ts"
1312
],
1413
"compilerOptions": {
1514
"allowJs": true,

0 commit comments

Comments
 (0)