Skip to content

Commit 5a3c2f3

Browse files
authored
Merge branch 'main' into feat/bigint/render-gk
2 parents a12181b + 64f354c commit 5a3c2f3

File tree

221 files changed

+3446
-1851
lines changed

Some content is hidden

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

221 files changed

+3446
-1851
lines changed

.circleci/config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ jobs:
9797
- setup_node_modules
9898
- run: node ./scripts/tasks/flow-ci
9999

100+
101+
yarn_flags:
102+
docker: *docker
103+
environment: *environment
104+
105+
steps:
106+
- checkout
107+
- setup_node_modules
108+
- run: yarn flags
109+
100110
scrape_warning_messages:
101111
docker: *docker
102112
environment: *environment
@@ -447,6 +457,11 @@ workflows:
447457
build_and_test:
448458
unless: << pipeline.parameters.prerelease_commit_sha >>
449459
jobs:
460+
- yarn_flags:
461+
filters:
462+
branches:
463+
ignore:
464+
- builds/facebook-www
450465
- yarn_flow:
451466
filters:
452467
branches:

.eslintrc.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ module.exports = {
381381
'jest/valid-expect-in-promise': ERROR,
382382
},
383383
},
384+
{
385+
// disable no focused tests for test setup helper files even if they are inside __tests__ directory
386+
files: ['**/setupTests.js'],
387+
rules: {
388+
'jest/no-focused-tests': OFF,
389+
},
390+
},
384391
{
385392
files: [
386393
'**/__tests__/**/*.js',
@@ -448,6 +455,13 @@ module.exports = {
448455
__IS_CHROME__: 'readonly',
449456
__IS_FIREFOX__: 'readonly',
450457
__IS_EDGE__: 'readonly',
458+
__IS_INTERNAL_VERSION__: 'readonly',
459+
},
460+
},
461+
{
462+
files: ['packages/react-devtools-shared/**/*.js'],
463+
globals: {
464+
__IS_INTERNAL_VERSION__: 'readonly',
451465
},
452466
},
453467
],

fixtures/dom/src/components/fixtures/suspense/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class TextInputFixtures extends React.Component {
213213

214214
<Fixture>
215215
<SuspendyTree>
216-
<img src="https://upload.wikimedia.org/wikipedia/commons/e/ee/Atom_%282%29.png" />
216+
<img src="https://upload.wikimedia.org/wikipedia/commons/1/1b/Atom.png" />
217217
React is cool
218218
</SuspendyTree>
219219
</Fixture>

packages/eslint-plugin-react-hooks/__tests__/ESLintRuleExhaustiveDeps-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6747,7 +6747,7 @@ const tests = {
67476747
' }\n' +
67486748
' fetchData();\n' +
67496749
`}, [someId]); // Or [] if effect doesn't need props or state\n\n` +
6750-
'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching',
6750+
'Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fetching',
67516751
suggestions: undefined,
67526752
},
67536753
],
@@ -6771,7 +6771,7 @@ const tests = {
67716771
' }\n' +
67726772
' fetchData();\n' +
67736773
`}, [someId]); // Or [] if effect doesn't need props or state\n\n` +
6774-
'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching',
6774+
'Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fetching',
67756775
suggestions: undefined,
67766776
},
67776777
],

packages/eslint-plugin-react-hooks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"engines": {
2727
"node": ">=10"
2828
},
29-
"homepage": "https://reactjs.org/",
29+
"homepage": "https://react.dev/",
3030
"peerDependencies": {
3131
"eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0"
3232
},

packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export default {
111111
' }\n' +
112112
' fetchData();\n' +
113113
`}, [someId]); // Or [] if effect doesn't need props or state\n\n` +
114-
'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching',
114+
'Learn more about data fetching with Hooks: https://react.dev/link/hooks-data-fetching',
115115
});
116116
}
117117

packages/jest-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"bugs": {
1818
"url": "https://github.com/facebook/react/issues"
1919
},
20-
"homepage": "https://reactjs.org/",
20+
"homepage": "https://react.dev/",
2121
"peerDependencies": {
2222
"jest": "^23.0.1 || ^24.0.0 || ^25.1.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0",
2323
"react": "^18.2.0",

packages/react-art/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
"bugs": {
2121
"url": "https://github.com/facebook/react/issues"
2222
},
23-
"homepage": "https://reactjs.org/",
23+
"homepage": "https://react.dev/",
2424
"dependencies": {
2525
"art": "^0.10.1",
2626
"create-react-class": "^15.6.2",
27-
"loose-envify": "^1.1.0",
2827
"scheduler": "^0.23.0"
2928
},
3029
"peerDependencies": {
@@ -39,10 +38,5 @@
3938
"Circle.js",
4039
"Rectangle.js",
4140
"Wedge.js"
42-
],
43-
"browserify": {
44-
"transform": [
45-
"loose-envify"
46-
]
47-
}
41+
]
4842
}

packages/react-client/package.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"keywords": [
77
"react"
88
],
9-
"homepage": "https://reactjs.org/",
9+
"homepage": "https://react.dev/",
1010
"bugs": "https://github.com/facebook/react/issues",
1111
"license": "MIT",
1212
"files": [
@@ -25,13 +25,5 @@
2525
},
2626
"peerDependencies": {
2727
"react": "^17.0.0"
28-
},
29-
"dependencies": {
30-
"loose-envify": "^1.1.0"
31-
},
32-
"browserify": {
33-
"transform": [
34-
"loose-envify"
35-
]
3628
}
3729
}

packages/react-client/src/__tests__/ReactFlight-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ describe('ReactFlight', () => {
994994
}).toErrorDev(
995995
'Each child in a list should have a unique "key" prop.\n' +
996996
'\n' +
997-
'Check the render method of `Component`. See https://reactjs.org/link/warning-keys for more information.\n' +
997+
'Check the render method of `Component`. See https://react.dev/link/warning-keys for more information.\n' +
998998
' in span (at **)\n' +
999999
' in Component (at **)\n' +
10001000
' in Indirection (at **)\n' +
@@ -1251,7 +1251,7 @@ describe('ReactFlight', () => {
12511251
ReactNoopFlightClient.read(transport);
12521252
}).toErrorDev(
12531253
'Each child in a list should have a unique "key" prop. ' +
1254-
'See https://reactjs.org/link/warning-keys for more information.',
1254+
'See https://react.dev/link/warning-keys for more information.',
12551255
);
12561256
});
12571257

packages/react-debug-tools/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"keywords": [
77
"react"
88
],
9-
"homepage": "https://reactjs.org/",
9+
"homepage": "https://react.dev/",
1010
"bugs": "https://github.com/facebook/react/issues",
1111
"license": "MIT",
1212
"files": [
@@ -28,6 +28,6 @@
2828
"react": "^17.0.0"
2929
},
3030
"dependencies": {
31-
"error-stack-parser": "^2.0.2"
31+
"error-stack-parser": "^2.1.4"
3232
}
3333
}

packages/react-debug-tools/src/ReactDebugHooks.js

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -427,16 +427,19 @@ function useTransition(): [
427427
// useTransition() composes multiple hooks internally.
428428
// Advance the current hook index the same number of times
429429
// so that subsequent hooks have the right memoized state.
430-
nextHook(); // State
430+
const stateHook = nextHook();
431431
nextHook(); // Callback
432+
433+
const isPending = stateHook !== null ? stateHook.memoizedState : false;
434+
432435
hookLog.push({
433436
displayName: null,
434437
primitive: 'Transition',
435438
stackError: new Error(),
436-
value: undefined,
439+
value: isPending,
437440
debugInfo: null,
438441
});
439-
return [false, callback => {}];
442+
return [isPending, () => {}];
440443
}
441444

442445
function useDeferredValue<T>(value: T, initialValue?: T): T {
@@ -521,19 +524,62 @@ function useFormState<S, P>(
521524
): [Awaited<S>, (P) => void] {
522525
const hook = nextHook(); // FormState
523526
nextHook(); // ActionQueue
524-
let state;
527+
const stackError = new Error();
528+
let value;
529+
let debugInfo = null;
530+
let error = null;
531+
525532
if (hook !== null) {
526-
state = hook.memoizedState;
533+
const actionResult = hook.memoizedState;
534+
if (
535+
typeof actionResult === 'object' &&
536+
actionResult !== null &&
537+
// $FlowFixMe[method-unbinding]
538+
typeof actionResult.then === 'function'
539+
) {
540+
const thenable: Thenable<Awaited<S>> = (actionResult: any);
541+
switch (thenable.status) {
542+
case 'fulfilled': {
543+
value = thenable.value;
544+
debugInfo =
545+
thenable._debugInfo === undefined ? null : thenable._debugInfo;
546+
break;
547+
}
548+
case 'rejected': {
549+
const rejectedError = thenable.reason;
550+
error = rejectedError;
551+
break;
552+
}
553+
default:
554+
// If this was an uncached Promise we have to abandon this attempt
555+
// but we can still emit anything up until this point.
556+
error = SuspenseException;
557+
debugInfo =
558+
thenable._debugInfo === undefined ? null : thenable._debugInfo;
559+
value = thenable;
560+
}
561+
} else {
562+
value = (actionResult: any);
563+
}
527564
} else {
528-
state = initialState;
565+
value = initialState;
529566
}
567+
530568
hookLog.push({
531569
displayName: null,
532570
primitive: 'FormState',
533-
stackError: new Error(),
534-
value: state,
535-
debugInfo: null,
571+
stackError: stackError,
572+
value: value,
573+
debugInfo: debugInfo,
536574
});
575+
576+
if (error !== null) {
577+
throw error;
578+
}
579+
580+
// value being a Thenable is equivalent to error being not null
581+
// i.e. we only reach this point with Awaited<S>
582+
const state = ((value: any): Awaited<S>);
537583
return [state, (payload: P) => {}];
538584
}
539585

0 commit comments

Comments
 (0)