Skip to content

Commit b4c4a6f

Browse files
authored
Merge pull request #983 from reactjs/sync-55986965
Sync with react.dev @ 5598696
2 parents 04a5df0 + 34f1554 commit b4c4a6f

Some content is hidden

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

64 files changed

+1613
-1700
lines changed

.github/workflows/analyze.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
- main # change this if your default branch is named differently
88
workflow_dispatch:
99

10+
permissions: {}
11+
1012
jobs:
1113
analyze:
1214
runs-on: ubuntu-latest
@@ -23,7 +25,7 @@ jobs:
2325
- name: Restore cached node_modules
2426
uses: actions/cache@v4
2527
with:
26-
path: "**/node_modules"
28+
path: '**/node_modules'
2729
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
2830

2931
- name: Install deps
@@ -55,7 +57,7 @@ jobs:
5557
name: bundle_analysis.json
5658

5759
- name: Download base branch bundle stats
58-
uses: dawidd6/action-download-artifact@v2
60+
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
5961
if: success() && github.event.number
6062
with:
6163
workflow: analyze.yml

.github/workflows/analyze_comment.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ name: Analyze Bundle (Comment)
22

33
on:
44
workflow_run:
5-
workflows: ["Analyze Bundle"]
5+
workflows: ['Analyze Bundle']
66
types:
77
- completed
88

9+
permissions: {}
10+
911
jobs:
1012
comment:
1113
runs-on: ubuntu-latest
@@ -14,15 +16,15 @@ jobs:
1416
github.event.workflow_run.conclusion == 'success' }}
1517
steps:
1618
- name: Download base branch bundle stats
17-
uses: dawidd6/action-download-artifact@v2
19+
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
1820
with:
1921
workflow: analyze.yml
2022
run_id: ${{ github.event.workflow_run.id }}
2123
name: analysis_comment.txt
2224
path: analysis_comment.txt
2325

2426
- name: Download PR number
25-
uses: dawidd6/action-download-artifact@v2
27+
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
2628
with:
2729
workflow: analyze.yml
2830
run_id: ${{ github.event.workflow_run.id }}
@@ -48,7 +50,7 @@ jobs:
4850
echo "pr-number=$pr_number" >> $GITHUB_OUTPUT
4951
5052
- name: Comment
51-
uses: marocchino/sticky-pull-request-comment@v2
53+
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728
5254
with:
5355
header: next-bundle-analysis
5456
number: ${{ steps.get-comment-body.outputs.pr-number }}

.github/workflows/discord_notify.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@ name: Discord Notify
22

33
on:
44
pull_request_target:
5-
types: [ labeled ]
5+
types: [opened, ready_for_review]
6+
7+
permissions: {}
68

79
jobs:
10+
check_maintainer:
11+
uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main
12+
permissions:
13+
# Used by check_maintainer
14+
contents: read
15+
with:
16+
actor: ${{ github.event.pull_request.user.login }}
17+
818
notify:
9-
if: ${{ github.event.label.name == 'React Core Team' }}
19+
if: ${{ needs.check_maintainer.outputs.is_core_team == 'true' }}
20+
needs: check_maintainer
1021
runs-on: ubuntu-latest
1122
steps:
1223
- name: Discord Webhook Action
@@ -18,4 +29,4 @@ jobs:
1829
embed-author-icon-url: ${{ github.event.pull_request.user.avatar_url }}
1930
embed-title: '#${{ github.event.number }} (+${{github.event.pull_request.additions}} -${{github.event.pull_request.deletions}}): ${{ github.event.pull_request.title }}'
2031
embed-description: ${{ github.event.pull_request.body }}
21-
embed-url: ${{ github.event.pull_request.html_url }}
32+
embed-url: ${{ github.event.pull_request.html_url }}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Label Core Team PRs
2+
3+
on:
4+
pull_request_target:
5+
6+
permissions: {}
7+
8+
env:
9+
TZ: /usr/share/zoneinfo/America/Los_Angeles
10+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
11+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
12+
13+
jobs:
14+
check_maintainer:
15+
uses: facebook/react/.github/workflows/shared_check_maintainer.yml@main
16+
permissions:
17+
# Used by check_maintainer
18+
contents: read
19+
with:
20+
actor: ${{ github.event.pull_request.user.login }}
21+
22+
label:
23+
if: ${{ needs.check_maintainer.outputs.is_core_team == 'true' }}
24+
runs-on: ubuntu-latest
25+
needs: check_maintainer
26+
permissions:
27+
# Used to add labels on issues
28+
issues: write
29+
# Used to add labels on PRs
30+
pull-requests: write
31+
steps:
32+
- name: Label PR as React Core Team
33+
uses: actions/github-script@v7
34+
with:
35+
script: |
36+
github.rest.issues.addLabels({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
issue_number: ${{ github.event.number }},
40+
labels: ['React Core Team']
41+
});

.github/workflows/site_lint.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
pull_request:
88
types: [opened, synchronize, reopened]
99

10+
permissions: {}
11+
1012
jobs:
1113
lint:
1214
runs-on: ubuntu-latest
@@ -25,7 +27,7 @@ jobs:
2527
- name: Restore cached node_modules
2628
uses: actions/cache@v4
2729
with:
28-
path: "**/node_modules"
30+
path: '**/node_modules'
2931
key: node_modules-${{ runner.arch }}-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
3032

3133
- name: Install deps

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
},
2525
"dependencies": {
2626
"@codesandbox/sandpack-react": "2.13.5",
27-
"@docsearch/css": "^3.6.1",
28-
"@docsearch/react": "^3.6.1",
27+
"@docsearch/css": "^3.8.3",
28+
"@docsearch/react": "^3.8.3",
2929
"@headlessui/react": "^1.7.0",
3030
"@radix-ui/react-context-menu": "^2.1.5",
3131
"body-scroll-lock": "^3.1.3",

public/images/team/andrey-lunyov.jpg

-56.2 KB
Binary file not shown.

public/images/team/hendrik.jpg

306 KB
Loading

public/images/team/jordan.jpg

281 KB
Loading
-129 KB
Binary file not shown.

public/images/team/lauren.jpg

-897 KB
Loading

public/images/team/luna-wei.jpg

-283 KB
Binary file not shown.

public/images/team/mike.jpg

310 KB
Loading

public/images/team/noahlemen.jpg

-330 KB
Binary file not shown.

public/images/team/pieter.jpg

359 KB
Loading

public/images/team/sam.jpg

-99.9 KB
Binary file not shown.

public/images/team/sathya.jpg

-68.8 KB
Binary file not shown.

public/images/team/tianyu.jpg

-51.4 KB
Binary file not shown.

src/components/Layout/HomeContent.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,13 @@ export function HomeContent() {
514514

515515
<div className="mt-20 px-5 lg:px-0 mb-6 max-w-4xl text-center text-opacity-80">
516516
<div className="uwu-visible flex justify-center">
517-
<img
517+
<Image
518518
alt="logo by @sawaratsuki1004"
519519
title="logo by @sawaratsuki1004"
520520
className="uwu-visible mb-10 lg:mb-8 h-24 lg:h-32"
521521
src="/images/uwu.png"
522+
width={100}
523+
height={100}
522524
/>
523525
</div>
524526
<Logo className="uwu-hidden text-brand dark:text-brand-dark w-24 lg:w-28 mb-10 lg:mb-8 mt-12 h-auto mx-auto self-start" />
@@ -805,10 +807,12 @@ const CommunityImages = memo(function CommunityImages({isLazy}) {
805807
? 'rotate-2 group-hover:rotate-[-1deg] group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl'
806808
: 'group-hover:rotate-1 group-hover:scale-110 group-hover:shadow-lg lg:group-hover:shadow-2xl rotate-[-2deg]'
807809
)}>
808-
<img
810+
<Image
809811
loading={isLazy ? 'lazy' : 'eager'}
810812
src={src}
811813
alt={alt}
814+
width={100}
815+
height={100}
812816
className="aspect-[4/3] h-full w-full flex object-cover rounded-2xl bg-gray-10 dark:bg-gray-80"
813817
/>
814818
</div>
@@ -1565,7 +1569,7 @@ function Cover({background, children}) {
15651569
<div className="absolute inset-0 px-4 py-2 flex items-end bg-gradient-to-t from-black/40 via-black/0">
15661570
{children}
15671571
</div>
1568-
<img
1572+
<Image
15691573
src={background}
15701574
width={500}
15711575
height={263}
@@ -1642,11 +1646,13 @@ function Thumbnail({video}) {
16421646
<>
16431647
<div className="transition-opacity mt-2.5 -space-x-2 flex flex-row w-full justify-center">
16441648
{image.speakers.map((src, i) => (
1645-
<img
1649+
<Image
16461650
key={i}
16471651
className="h-8 w-8 border-2 shadow-md border-gray-70 object-cover rounded-full"
16481652
src={src}
16491653
alt=""
1654+
width={100}
1655+
height={100}
16501656
/>
16511657
))}
16521658
</div>

src/components/Layout/Page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {useRouter} from 'next/router';
88
import {SidebarNav} from './SidebarNav';
99
import {Footer} from './Footer';
1010
import {Toc} from './Toc';
11-
// import SocialBanner from '../SocialBanner';
11+
import SocialBanner from '../SocialBanner';
1212
import {DocsPageFooter} from 'components/DocsFooter';
1313
import {Seo} from 'components/Seo';
1414
import PageHeading from 'components/PageHeading';
@@ -137,7 +137,7 @@ export function Page({
137137
/>
138138
</Head>
139139
)}
140-
{/*<SocialBanner />*/}
140+
<SocialBanner />
141141
<TopNav
142142
section={section}
143143
routeTree={routeTree}

src/components/MDX/CodeBlock/CodeBlock.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ function getInlineDecorators(
336336
line.step === 3,
337337
'bg-green-40 border-green-40 text-green-60 dark:text-green-30':
338338
line.step === 4,
339+
// TODO: Some codeblocks use up to 6 steps.
339340
}
340341
),
341342
})

src/components/MDX/ErrorDecoder.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function parseQueryString(search: string): Array<string | undefined> {
6969
}
7070

7171
export default function ErrorDecoder() {
72-
const {errorMessage} = useErrorDecoderParams();
72+
const {errorMessage, errorCode} = useErrorDecoderParams();
7373
/** error messages that contain %s require reading location.search */
7474
const hasParams = errorMessage?.includes('%s');
7575
const [message, setMessage] = useState<React.ReactNode | null>(() =>
@@ -82,23 +82,28 @@ export default function ErrorDecoder() {
8282
if (errorMessage == null || !hasParams) {
8383
return;
8484
}
85+
const args = parseQueryString(window.location.search);
86+
let message = errorMessage;
87+
if (errorCode === '418') {
88+
// Hydration errors have a %s for the diff, but we don't add that to the args for security reasons.
89+
message = message.replace(/%s$/, '');
8590

86-
setMessage(
87-
urlify(
88-
replaceArgs(
89-
errorMessage,
90-
parseQueryString(window.location.search),
91-
'[missing argument]'
92-
)
93-
)
94-
);
91+
// Before React 19.1, the error message didn't have an arg, and was always HTML.
92+
if (args.length === 0) {
93+
args.push('HTML');
94+
} else if (args.length === 1 && args[0] === '') {
95+
args[0] = 'HTML';
96+
}
97+
}
98+
99+
setMessage(urlify(replaceArgs(message, args, '[missing argument]')));
95100
setIsReady(true);
96-
}, [hasParams, errorMessage]);
101+
}, [errorCode, hasParams, errorMessage]);
97102

98103
return (
99104
<code
100105
className={cn(
101-
'block bg-red-100 text-red-600 py-4 px-6 mt-5 rounded-lg',
106+
'whitespace-pre-line block bg-red-100 text-red-600 py-4 px-6 mt-5 rounded-lg',
102107
isReady ? 'opacity-100' : 'opacity-0'
103108
)}>
104109
<b>{message}</b>

src/components/MDX/MDXComponents.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {Children, useContext, useMemo} from 'react';
66
import * as React from 'react';
77
import cn from 'classnames';
88
import type {HTMLAttributes} from 'react';
9+
import Image from 'next/image';
910

1011
import CodeBlock from './CodeBlock';
1112
import {CodeDiagram} from './CodeDiagram';
@@ -285,9 +286,11 @@ function Illustration({
285286
return (
286287
<div className="relative group before:absolute before:-inset-y-16 before:inset-x-0 my-16 mx-0 2xl:mx-auto max-w-4xl 2xl:max-w-6xl">
287288
<figure className="my-8 flex justify-center">
288-
<img
289+
<Image
289290
src={src}
290291
alt={alt}
292+
width={700}
293+
height={300}
291294
style={{maxHeight: 300}}
292295
className="rounded-lg"
293296
/>
@@ -321,11 +324,12 @@ function IllustrationBlock({
321324
const images = imageInfos.map((info, index) => (
322325
<figure key={index}>
323326
<div className="bg-white rounded-lg p-4 flex-1 flex xl:p-6 justify-center items-center my-4">
324-
<img
327+
<Image
325328
className="text-primary"
326329
src={info.src}
327330
alt={info.alt}
328-
height={info.height}
331+
width={700}
332+
height={info.height || 300}
329333
/>
330334
</div>
331335
{info.caption ? (
@@ -455,9 +459,17 @@ function YouTubeIframe(props: any) {
455459
);
456460
}
457461

458-
function Image(props: any) {
462+
function CustomImage(props: any) {
459463
const {alt, ...rest} = props;
460-
return <img alt={alt} className="max-w-[calc(min(700px,100%))]" {...rest} />;
464+
return (
465+
<Image
466+
alt={alt}
467+
className="max-w-[calc(min(700px,100%))]"
468+
width={700}
469+
height={400}
470+
{...rest}
471+
/>
472+
);
461473
}
462474

463475
export const MDXComponents = {
@@ -474,7 +486,7 @@ export const MDXComponents = {
474486
h5: H5,
475487
hr: Divider,
476488
a: Link,
477-
img: Image,
489+
img: CustomImage,
478490
BlogCard,
479491
code: InlineCode,
480492
pre: CodeBlock,

src/components/MDX/Sandpack/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ root.render(
2828
eject: 'react-scripts eject',
2929
},
3030
dependencies: {
31-
react: '19.0.0-rc-3edc000d-20240926',
32-
'react-dom': '19.0.0-rc-3edc000d-20240926',
31+
react: '^19.1.0',
32+
'react-dom': '^19.1.0',
3333
'react-scripts': '^5.0.0',
3434
},
3535
},

src/components/MDX/TeamMember.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import * as React from 'react';
6-
import Image from 'next/image';
6+
import Image from 'next/legacy/image';
77
import {IconTwitter} from '../Icon/IconTwitter';
88
import {IconThreads} from '../Icon/IconThreads';
99
import {IconBsky} from '../Icon/IconBsky';

src/components/SocialBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {useRef, useEffect} from 'react';
77
import cn from 'classnames';
88
import {ExternalLink} from './ExternalLink';
99

10-
const bannerText = 'Únete a la React Conf del 15 al 16 de mayo.';
10+
const bannerText = 'Únete a la React Conf del 7 al 8 de Octubre.';
1111
const bannerLink = 'https://conf.react.dev/';
1212
const bannerLinkText = 'Más información.';
1313

0 commit comments

Comments
 (0)