Skip to content

Commit 935e8f8

Browse files
committed
merge?
2 parents 6b48b45 + 327d5c4 commit 935e8f8

File tree

250 files changed

+3262
-3571
lines changed

Some content is hidden

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

250 files changed

+3262
-3571
lines changed

.circleci/config.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2.1
22

33
aliases:
44
- &docker
5-
- image: circleci/openjdk:8-jdk-node-browsers
5+
- image: cimg/openjdk:17.0.0-node
66

77
- &environment
88
TZ: /usr/share/zoneinfo/America/Los_Angeles
@@ -209,7 +209,20 @@ jobs:
209209
- run: yarn workspaces info | head -n -1 > workspace_info.txt
210210
- *restore_node_modules
211211
- run: yarn lint-build
212-
- run: scripts/circleci/check_minified_errors.sh
212+
213+
check_error_codes:
214+
docker: *docker
215+
environment: *environment
216+
steps:
217+
- checkout
218+
- attach_workspace: *attach_workspace
219+
- run: yarn workspaces info | head -n -1 > workspace_info.txt
220+
- *restore_node_modules
221+
- run:
222+
name: Search build artifacts for unminified errors
223+
command: |
224+
yarn extract-errors
225+
git diff || (echo "Found unminified errors. Either update the error codes map or disable error minification for the affected build, if appropriate." && false)
213226
214227
yarn_test:
215228
docker: *docker
@@ -414,6 +427,9 @@ workflows:
414427
- yarn_lint_build:
415428
requires:
416429
- yarn_build_combined
430+
- check_error_codes:
431+
requires:
432+
- yarn_build_combined
417433
- RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
418434
requires:
419435
- yarn_build_combined

.eslintignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ packages/react-devtools-inline/dist
2222
packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/
2323
packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/
2424
packages/react-devtools-shell/dist
25-
packages/react-devtools-scheduling-profiler/dist
26-
packages/react-devtools-scheduling-profiler/static
25+
packages/react-devtools-timeline/dist
26+
packages/react-devtools-timeline/static

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ module.exports = {
151151
'packages/react-test-renderer/**/*.js',
152152
'packages/react-debug-tools/**/*.js',
153153
'packages/react-devtools-extensions/**/*.js',
154-
'packages/react-devtools-scheduling-profiler/**/*.js',
154+
'packages/react-devtools-timeline/**/*.js',
155155
'packages/react-native-renderer/**/*.js',
156156
'packages/eslint-plugin-react-hooks/**/*.js',
157157
'packages/jest-react/**/*.js',

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ packages/react-devtools-extensions/shared/build
3535
packages/react-devtools-extensions/.tempUserDataDir
3636
packages/react-devtools-inline/dist
3737
packages/react-devtools-shell/dist
38-
packages/react-devtools-scheduling-profiler/dist
38+
packages/react-devtools-timeline/dist

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ packages/react-devtools-inline/dist
77
packages/react-devtools-shared/src/hooks/__tests__/__source__/__compiled__/
88
packages/react-devtools-shared/src/hooks/__tests__/__source__/__untransformed__/
99
packages/react-devtools-shell/dist
10-
packages/react-devtools-scheduling-profiler/dist
11-
packages/react-devtools-scheduling-profiler/static
10+
packages/react-devtools-timeline/dist
11+
packages/react-devtools-timeline/static

ReactVersions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const stablePackages = {
3636
'react-refresh': '0.11.0',
3737
'react-test-renderer': ReactVersion,
3838
'use-subscription': '1.6.0',
39+
'use-sync-external-store': '1.0.0',
3940
scheduler: '0.21.0',
4041
};
4142

@@ -47,7 +48,6 @@ const experimentalPackages = [
4748
'react-fs',
4849
'react-pg',
4950
'react-server-dom-webpack',
50-
'use-sync-external-store',
5151
];
5252

5353
module.exports = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"linc": "node ./scripts/tasks/linc.js",
115115
"lint": "node ./scripts/tasks/eslint.js",
116116
"lint-build": "node ./scripts/rollup/validate/index.js",
117-
"extract-errors": "yarn build --type=dev --extract-errors",
117+
"extract-errors": "node scripts/error-codes/extract-errors.js",
118118
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json && node ./scripts/flow/createFlowConfigs.js && node ./scripts/yarn/downloadReactIsForPrettyFormat.js",
119119
"debug-test": "yarn test --deprecated 'yarn test --debug'",
120120
"test": "node ./scripts/jest/jest-cli.js",

packages/react-art/src/ReactARTHostConfig.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -436,24 +436,6 @@ export function getInstanceFromNode(node) {
436436
throw new Error('Not implemented.');
437437
}
438438

439-
export function isOpaqueHydratingObject(value: mixed): boolean {
440-
throw new Error('Not implemented.');
441-
}
442-
443-
export function makeOpaqueHydratingObject(
444-
attemptToReadValue: () => void,
445-
): OpaqueIDType {
446-
throw new Error('Not implemented.');
447-
}
448-
449-
export function makeClientId(): OpaqueIDType {
450-
throw new Error('Not implemented.');
451-
}
452-
453-
export function makeClientIdInDEV(warnOnAccessInDEV: () => void): OpaqueIDType {
454-
throw new Error('Not implemented.');
455-
}
456-
457439
export function beforeActiveInstanceBlur(internalInstanceHandle: Object) {
458440
// noop
459441
}

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

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ import type {
1818
Fiber,
1919
Dispatcher as DispatcherType,
2020
} from 'react-reconciler/src/ReactInternalTypes';
21-
import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig';
22-
23-
import {NoMode} from 'react-reconciler/src/ReactTypeOfMode';
2421

2522
import ErrorStackParser from 'error-stack-parser';
2623
import ReactSharedInternals from 'shared/ReactSharedInternals';
27-
import {REACT_OPAQUE_ID_TYPE} from 'shared/ReactSymbols';
2824
import {
2925
FunctionComponent,
3026
SimpleMemoComponent,
@@ -53,8 +49,6 @@ type Dispatch<A> = A => void;
5349

5450
let primitiveStackCache: null | Map<string, Array<any>> = null;
5551

56-
let currentFiber: Fiber | null = null;
57-
5852
type Hook = {
5953
memoizedState: any,
6054
next: Hook | null,
@@ -324,21 +318,15 @@ function useDeferredValue<T>(value: T): T {
324318
return value;
325319
}
326320

327-
function useOpaqueIdentifier(): OpaqueIDType | void {
328-
const hook = nextHook(); // State
329-
if (currentFiber && currentFiber.mode === NoMode) {
330-
nextHook(); // Effect
331-
}
332-
let value = hook === null ? undefined : hook.memoizedState;
333-
if (value && value.$$typeof === REACT_OPAQUE_ID_TYPE) {
334-
value = undefined;
335-
}
321+
function useId(): string {
322+
const hook = nextHook();
323+
const id = hook !== null ? hook.memoizedState : '';
336324
hookLog.push({
337-
primitive: 'OpaqueIdentifier',
325+
primitive: 'Id',
338326
stackError: new Error(),
339-
value,
327+
value: id,
340328
});
341-
return value;
329+
return id;
342330
}
343331

344332
const Dispatcher: DispatcherType = {
@@ -360,7 +348,7 @@ const Dispatcher: DispatcherType = {
360348
useMutableSource,
361349
useSyncExternalStore,
362350
useDeferredValue,
363-
useOpaqueIdentifier,
351+
useId,
364352
};
365353

366354
// Inspect
@@ -755,8 +743,6 @@ export function inspectHooksOfFiber(
755743
currentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
756744
}
757745

758-
currentFiber = fiber;
759-
760746
if (
761747
fiber.tag !== FunctionComponent &&
762748
fiber.tag !== SimpleMemoComponent &&

packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,10 @@ describe('ReactHooksInspectionIntegration', () => {
598598
]);
599599
});
600600

601-
it('should support composite useOpaqueIdentifier hook', () => {
601+
it('should support useId hook', () => {
602602
function Foo(props) {
603-
const id = React.unstable_useOpaqueIdentifier();
604-
const [state] = React.useState(() => 'hello', []);
603+
const id = React.useId();
604+
const [state] = React.useState('hello');
605605
return <div id={id}>{state}</div>;
606606
}
607607

@@ -613,39 +613,8 @@ describe('ReactHooksInspectionIntegration', () => {
613613

614614
expect(tree[0].id).toEqual(0);
615615
expect(tree[0].isStateEditable).toEqual(false);
616-
expect(tree[0].name).toEqual('OpaqueIdentifier');
617-
expect(String(tree[0].value).startsWith('c_')).toBe(true);
618-
619-
expect(tree[1]).toEqual({
620-
id: 1,
621-
isStateEditable: true,
622-
name: 'State',
623-
value: 'hello',
624-
subHooks: [],
625-
});
626-
});
627-
628-
it('should support composite useOpaqueIdentifier hook in concurrent mode', () => {
629-
function Foo(props) {
630-
const id = React.unstable_useOpaqueIdentifier();
631-
const [state] = React.useState(() => 'hello', []);
632-
return <div id={id}>{state}</div>;
633-
}
634-
635-
const renderer = ReactTestRenderer.create(<Foo />, {
636-
unstable_isConcurrent: true,
637-
});
638-
expect(Scheduler).toFlushWithoutYielding();
639-
640-
const childFiber = renderer.root.findByType(Foo)._currentFiber();
641-
const tree = ReactDebugTools.inspectHooksOfFiber(childFiber);
642-
643-
expect(tree.length).toEqual(2);
644-
645-
expect(tree[0].id).toEqual(0);
646-
expect(tree[0].isStateEditable).toEqual(false);
647-
expect(tree[0].name).toEqual('OpaqueIdentifier');
648-
expect(String(tree[0].value).startsWith('c_')).toBe(true);
616+
expect(tree[0].name).toEqual('Id');
617+
expect(String(tree[0].value).startsWith('r:')).toBe(true);
649618

650619
expect(tree[1]).toEqual({
651620
id: 1,
@@ -1018,6 +987,7 @@ describe('ReactHooksInspectionIntegration', () => {
1018987
]);
1019988
});
1020989

990+
// @gate enableUseMutableSource
1021991
it('should support composite useMutableSource hook', () => {
1022992
const createMutableSource =
1023993
React.createMutableSource || React.unstable_createMutableSource;
@@ -1055,9 +1025,8 @@ describe('ReactHooksInspectionIntegration', () => {
10551025
]);
10561026
});
10571027

1058-
// @gate experimental || www
10591028
it('should support composite useSyncExternalStore hook', () => {
1060-
const useSyncExternalStore = React.unstable_useSyncExternalStore;
1029+
const useSyncExternalStore = React.useSyncExternalStore;
10611030
function Foo() {
10621031
const value = useSyncExternalStore(
10631032
() => () => {},

0 commit comments

Comments
 (0)