Skip to content

Commit ca33858

Browse files
authored
fix: handle React v18.3 warnings (#10079)
1 parent f1cb4ed commit ca33858

File tree

69 files changed

+85
-48
lines changed

Some content is hidden

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

69 files changed

+85
-48
lines changed

.github/workflows/argos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: npx playwright install --with-deps chromium
4242

4343
- name: Build website fast
44-
run: yarn build:website:fast
44+
run: yarn build:website:fast --dev
4545

4646
- name: Take Argos screenshots
4747
run: yarn argos:screenshot

argos/tests/screenshot.spec.ts

+47
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as fs from 'fs';
88
import {test} from '@playwright/test';
99
import {argosScreenshot} from '@argos-ci/playwright';
1010
import * as cheerio from 'cheerio';
11+
import type {Page} from '@playwright/test';
1112

1213
const siteUrl = 'http://localhost:3000';
1314
const sitemapPath = '../website/build/sitemap.xml';
@@ -61,9 +62,12 @@ function getPathnames(): string[] {
6162
(pathname) => !isBlacklisted(pathname),
6263
);
6364
pathnames.sort();
65+
/*
6466
console.log('Pathnames:\n', JSON.stringify(pathnames, null, 2));
6567
console.log('Pathnames before filtering', pathnamesUnfiltered.length);
6668
console.log('Pathnames after filtering', pathnames.length);
69+
70+
*/
6771
return pathnames;
6872
}
6973

@@ -91,8 +95,47 @@ function waitForDocusaurusHydration() {
9195
return document.documentElement.dataset.hasHydrated === 'true';
9296
}
9397

98+
// Ensure that Docusaurus site pages do not emit unexpected errors/warnings
99+
// See https://github.com/microsoft/playwright/issues/27277
100+
// TODO this shouldn't be the responsibility of Argos tests to do this
101+
// but this is convenient to do this here for now
102+
function throwOnConsole(page: Page) {
103+
const typesToCheck = ['error', 'warning'];
104+
105+
const ignoreMessages = [
106+
// This mismatch warning looks like a React 18 bug to me
107+
'Warning: Prop `%s` did not match. Server: %s Client: %s%s className "null" ""',
108+
109+
// TODO this fetch error message is unexpected and should be fixed
110+
// it's already happening in main branch
111+
'Failed to load resource: the server responded with a status of 404 (Not Found)',
112+
113+
// TODO looks like a legit hydration bug to fix
114+
'Warning: Prop `%s` did not match. Server: %s Client: %s%s href "/docs/configuration" "/docs/configuration?docusaurus-theme=light"',
115+
116+
// TODO weird problem related to KaTeX fonts refusing to decode?
117+
// on http://localhost:3000/docs/markdown-features/math-equations
118+
'Failed to decode downloaded font: http://localhost:3000/katex/fonts/',
119+
'OTS parsing error: Failed to convert WOFF 2.0 font to SFNT',
120+
];
121+
122+
page.on('console', (message) => {
123+
if (!typesToCheck.includes(message.type())) {
124+
return;
125+
}
126+
if (ignoreMessages.some((msg) => message.text().includes(msg))) {
127+
return;
128+
}
129+
throw new Error(`Docusaurus site page unexpectedly logged something to the browser console
130+
Type=${message.type()}
131+
Text=${message.text()}
132+
Location=${message.location().url}`);
133+
});
134+
}
135+
94136
function createPathnameTest(pathname: string) {
95137
test(`pathname ${pathname}`, async ({page}) => {
138+
throwOnConsole(page);
96139
const url = siteUrl + pathname;
97140
await page.goto(url);
98141
await page.waitForFunction(waitForDocusaurusHydration);
@@ -102,6 +145,10 @@ function createPathnameTest(pathname: string) {
102145
});
103146
}
104147

148+
// Allow parallel execution within a single test file
149+
// See https://playwright.dev/docs/test-parallel
150+
test.describe.configure({mode: 'parallel'});
151+
105152
test.describe('Docusaurus site screenshots', () => {
106153
const pathnames = getPathnames();
107154
pathnames.forEach(createPathnameTest);

packages/docusaurus-module-type-aliases/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
"directory": "packages/docusaurus-module-type-aliases"
1313
},
1414
"dependencies": {
15-
"@docusaurus/react-loadable": "5.5.2",
1615
"@docusaurus/types": "3.2.1",
1716
"@types/history": "^4.7.11",
1817
"@types/react": "*",
1918
"@types/react-router-config": "*",
2019
"@types/react-router-dom": "*",
2120
"react-helmet-async": "*",
22-
"react-loadable": "npm:@docusaurus/react-loadable@5.5.2"
21+
"react-loadable": "npm:@docusaurus/react-loadable@6.0.0"
2322
},
2423
"peerDependencies": {
2524
"react": "*",

packages/docusaurus-preset-classic/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default function preset(
8989
),
9090
);
9191
}
92-
if (isProd && sitemap !== false) {
92+
if (sitemap !== false && (isProd || debug)) {
9393
plugins.push(makePluginConfig('@docusaurus/plugin-sitemap', sitemap));
9494
}
9595
if (Object.keys(rest).length > 0) {

packages/docusaurus-theme-classic/src/theme/CodeBlock/Line/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function CodeBlockLine({
2828
});
2929

3030
const lineTokens = line.map((token, key) => (
31-
<span key={key} {...getTokenProps({token, key})} />
31+
<span key={key} {...getTokenProps({token})} />
3232
));
3333

3434
return (

packages/docusaurus-theme-live-codeblock/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@philpl/buble": "^0.19.7",
3131
"clsx": "^2.0.0",
3232
"fs-extra": "^11.1.1",
33-
"react-live": "^4.1.5",
33+
"react-live": "^4.1.6",
3434
"tslib": "^2.6.0"
3535
},
3636
"devDependencies": {

packages/docusaurus/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"@docusaurus/cssnano-preset": "3.2.1",
4747
"@docusaurus/logger": "3.2.1",
4848
"@docusaurus/mdx-loader": "3.2.1",
49-
"@docusaurus/react-loadable": "5.5.2",
5049
"@docusaurus/utils": "3.2.1",
5150
"@docusaurus/utils-common": "3.2.1",
5251
"@docusaurus/utils-validation": "3.2.1",
@@ -85,7 +84,7 @@
8584
"prompts": "^2.4.2",
8685
"react-dev-utils": "^12.0.1",
8786
"react-helmet-async": "^1.3.0",
88-
"react-loadable": "npm:@docusaurus/react-loadable@5.5.2",
87+
"react-loadable": "npm:@docusaurus/react-loadable@6.0.0",
8988
"react-loadable-ssr-addon-v5-slorber": "^1.0.1",
9089
"react-router": "^5.3.4",
9190
"react-router-config": "^5.1.1",

project-words.txt

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ sensical
313313
setaf
314314
setext
315315
setlocal
316+
SFNT
316317
shiki
317318
Shiki
318319
shortcodes
69.3 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
58.6 KB
Binary file not shown.
34.2 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
44.9 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
43.4 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-136 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
-128 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
-224 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
-208 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

yarn.lock

+31-40
Original file line numberDiff line numberDiff line change
@@ -1639,14 +1639,6 @@
16391639
"@docsearch/css" "3.5.2"
16401640
algoliasearch "^4.19.1"
16411641

1642-
"@docusaurus/react-loadable@5.5.2":
1643-
version "5.5.2"
1644-
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
1645-
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
1646-
dependencies:
1647-
"@types/react" "*"
1648-
prop-types "^15.6.2"
1649-
16501642
"@docusaurus/responsive-loader@^1.7.0":
16511643
version "1.7.0"
16521644
resolved "https://registry.yarnpkg.com/@docusaurus/responsive-loader/-/responsive-loader-1.7.0.tgz#508df2779e04311aa2a38efb67cf743109afd681"
@@ -3489,9 +3481,9 @@
34893481
"@types/webpack-dev-server" "3"
34903482

34913483
"@types/react-dom@^18.2.7":
3492-
version "18.2.7"
3493-
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.7.tgz#67222a08c0a6ae0a0da33c3532348277c70abb63"
3494-
integrity sha512-GRaAEriuT4zp9N4p1i8BDBYmEyfo+xQ3yHjJU4eiK5NDa1RmUZG+unZABUTK4/Ox/M+GaHwb6Ow8rUITrtjszA==
3484+
version "18.3.0"
3485+
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.0.tgz#0cbc818755d87066ab6ca74fbedb2547d74a82b0"
3486+
integrity sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==
34953487
dependencies:
34963488
"@types/react" "*"
34973489

@@ -13717,12 +13709,12 @@ react-dev-utils@^12.0.1:
1371713709
text-table "^0.2.0"
1371813710

1371913711
react-dom@^18.0.0:
13720-
version "18.2.0"
13721-
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d"
13722-
integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==
13712+
version "18.3.0"
13713+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.0.tgz#98a3a1cc4e471d517c2a084f38ab1d58d02cada7"
13714+
integrity sha512-zaKdLBftQJnvb7FtDIpZtsAIb2MZU087RM8bRDZU8LVCCFYjPTsDZJNFUWPcVz3HFSN1n/caxi0ca4B/aaVQGQ==
1372313715
dependencies:
1372413716
loose-envify "^1.1.0"
13725-
scheduler "^0.23.0"
13717+
scheduler "^0.23.1"
1372613718

1372713719
react-error-boundary@^3.1.0:
1372813720
version "3.1.4"
@@ -13752,10 +13744,10 @@ react-helmet-async@*, react-helmet-async@^1.3.0:
1375213744
react-fast-compare "^3.2.0"
1375313745
shallowequal "^1.1.0"
1375413746

13755-
"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", "react-is@^17.0.1 || ^18.0.0", react-is@^18.0.0, react-is@^18.2.0:
13756-
version "18.2.0"
13757-
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
13758-
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==
13747+
"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", "react-is@^17.0.1 || ^18.0.0", react-is@^18.0.0, react-is@^18.3.0:
13748+
version "18.3.0"
13749+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.0.tgz#6c2d9b6cdd4c2cffb7c89b1bcb57bc44d12f1993"
13750+
integrity sha512-wRiUsea88TjKDc4FBEn+sLvIDesp6brMbGWnJGjew2waAc9evdhja/2LvePc898HJbHw0L+MTWy7NhpnELAvLQ==
1375913751

1376013752
react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0:
1376113753
version "16.13.1"
@@ -13772,10 +13764,10 @@ react-lite-youtube-embed@^2.3.52:
1377213764
resolved "https://registry.yarnpkg.com/react-lite-youtube-embed/-/react-lite-youtube-embed-2.3.52.tgz#7f8125a03e7a940745b63d11abd6821ffe1babe5"
1377313765
integrity sha512-G010PvCavA4EqL8mZ/Sv9XXiHnjMfONW+lmNeCRnSEPluPdptv2lZ0cNlngrj7K9j7luc8pbpyrmNpKbD9VMmw==
1377413766

13775-
react-live@^4.1.5:
13776-
version "4.1.5"
13777-
resolved "https://registry.yarnpkg.com/react-live/-/react-live-4.1.5.tgz#a4fa4cfdcad763503a209a29bace3339764fdfb1"
13778-
integrity sha512-ul3Zwvqvh6KTg8j7xGCT26+c8J9vQ+LFUrZCbrrrzEExuVB/39s1GKG3NsywnL+aGAjpfnUTaVCe7KlKIvVPiw==
13767+
react-live@^4.1.6:
13768+
version "4.1.6"
13769+
resolved "https://registry.yarnpkg.com/react-live/-/react-live-4.1.6.tgz#6d9b7d381bd2b359ca859767501135112b6bab33"
13770+
integrity sha512-2oq3MADi3rupqZcdoHMrV9p+Eg/92BDds278ZuoOz8d68qw6ct0xZxX89MRxeChrnFHy1XPr8BVknDJNJNdvVw==
1377913771
dependencies:
1378013772
prism-react-renderer "^2.0.6"
1378113773
sucrase "^3.31.0"
@@ -13788,13 +13780,12 @@ react-loadable-ssr-addon-v5-slorber@^1.0.1:
1378813780
dependencies:
1378913781
"@babel/runtime" "^7.10.3"
1379013782

13791-
"react-loadable@npm:@docusaurus/react-loadable@5.5.2":
13792-
version "5.5.2"
13793-
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-5.5.2.tgz#81aae0db81ecafbdaee3651f12804580868fa6ce"
13794-
integrity sha512-A3dYjdBGuy0IGT+wyLIGIKLRE+sAk1iNk0f1HjNDysO7u8lhL4N3VEm+FAubmJbAztn94F7MxBTPmnixbiyFdQ==
13783+
"react-loadable@npm:@docusaurus/react-loadable@6.0.0":
13784+
version "6.0.0"
13785+
resolved "https://registry.yarnpkg.com/@docusaurus/react-loadable/-/react-loadable-6.0.0.tgz#de6c7f73c96542bd70786b8e522d535d69069dc4"
13786+
integrity sha512-YMMxTUQV/QFSnbgrP3tjDzLHRg7vsbMn8e9HAa8o/1iXoiomo48b7sk/kkmWEuWNDPJVlKSJRB6Y2fHqdJk+SQ==
1379513787
dependencies:
1379613788
"@types/react" "*"
13797-
prop-types "^15.6.2"
1379813789

1379913790
react-medium-image-zoom@^5.1.6:
1380013791
version "5.1.6"
@@ -13845,13 +13836,13 @@ react-shallow-renderer@^16.15.0:
1384513836
react-is "^16.12.0 || ^17.0.0 || ^18.0.0"
1384613837

1384713838
react-test-renderer@^18.0.0:
13848-
version "18.2.0"
13849-
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.2.0.tgz#1dd912bd908ff26da5b9fca4fd1c489b9523d37e"
13850-
integrity sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==
13839+
version "18.3.0"
13840+
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.3.0.tgz#579dec2312b9841f7a0cafc1dfbdfdc582be0ea4"
13841+
integrity sha512-eFnJU8sSYq9I6VI8ISrXDm+7F0igeFlTc0Ngq2XCkVasR5AsyJRg8SuwcD9D5E+VvDS2NrYGZ+gKpO43/wIDHw==
1385113842
dependencies:
13852-
react-is "^18.2.0"
13843+
react-is "^18.3.0"
1385313844
react-shallow-renderer "^16.15.0"
13854-
scheduler "^0.23.0"
13845+
scheduler "^0.23.1"
1385513846

1385613847
react-waypoint@^10.3.0:
1385713848
version "10.3.0"
@@ -13864,9 +13855,9 @@ react-waypoint@^10.3.0:
1386413855
react-is "^17.0.1 || ^18.0.0"
1386513856

1386613857
react@^18.0.0:
13867-
version "18.2.0"
13868-
resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
13869-
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
13858+
version "18.3.0"
13859+
resolved "https://registry.yarnpkg.com/react/-/react-18.3.0.tgz#84386d0a36fdf5ef50fa5755b7812bdfb76194a5"
13860+
integrity sha512-RPutkJftSAldDibyrjuku7q11d3oy6wKOyPe5K1HA/HwwrXcEqBdHsLypkC2FFYjP7bPUa6gbzSBhw4sY2JcDg==
1387013861
dependencies:
1387113862
loose-envify "^1.1.0"
1387213863

@@ -14539,10 +14530,10 @@ saxes@^6.0.0:
1453914530
dependencies:
1454014531
xmlchars "^2.2.0"
1454114532

14542-
scheduler@^0.23.0:
14543-
version "0.23.0"
14544-
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe"
14545-
integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==
14533+
scheduler@^0.23.1:
14534+
version "0.23.1"
14535+
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.1.tgz#ef964a7936d7cbe8f7bc0d38fc479a823aed2923"
14536+
integrity sha512-5GKS5JGfiah1O38Vfa9srZE4s3wdHbwjlCrvIookrg2FO9aIwKLOJXuJQFlEfNcVSOXuaL2hzDeY20uVXcUtrw==
1454614537
dependencies:
1454714538
loose-envify "^1.1.0"
1454814539

0 commit comments

Comments
 (0)