GeezerVison is showing github.com — Remove experimental useOpaqueIdentifier API (#22672) · react/react@75f3dde
File treeExpand file treeCollapse file tree Open diff view settings react-devtools-shared/src/backend react-native-renderer/src react-suspense-test-utils/src
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-art/src/ReactARTHostConfig.js -18Lines changed: 0 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -436,24 +436,6 @@ export function getInstanceFromNode(node) { | 436 | 436 | throw new Error('Not implemented.'); | 437 | 437 | } | 438 | 438 |
| 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 | | - | 457 | 439 | export function beforeActiveInstanceBlur(internalInstanceHandle: Object) { | 458 | 440 | // noop | 459 | 441 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-debug-tools/src/ReactDebugHooks.js -26Lines changed: 0 additions & 26 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,13 +18,9 @@ import type { | 18 | 18 | Fiber, | 19 | 19 | Dispatcher as DispatcherType, | 20 | 20 | } from 'react-reconciler/src/ReactInternalTypes'; | 21 | | -import type {OpaqueIDType} from 'react-reconciler/src/ReactFiberHostConfig'; | 22 | | - | 23 | | -import {NoMode} from 'react-reconciler/src/ReactTypeOfMode'; | 24 | 21 |
| 25 | 22 | import ErrorStackParser from 'error-stack-parser'; | 26 | 23 | import ReactSharedInternals from 'shared/ReactSharedInternals'; | 27 | | -import {REACT_OPAQUE_ID_TYPE} from 'shared/ReactSymbols'; | 28 | 24 | import { | 29 | 25 | FunctionComponent, | 30 | 26 | SimpleMemoComponent, | @@ -53,8 +49,6 @@ type Dispatch<A> = A => void; | 53 | 49 |
| 54 | 50 | let primitiveStackCache: null | Map<string, Array<any>> = null; | 55 | 51 |
| 56 | | -let currentFiber: Fiber | null = null; | 57 | | - | 58 | 52 | type Hook = { | 59 | 53 | memoizedState: any, | 60 | 54 | next: Hook | null, | @@ -324,23 +318,6 @@ function useDeferredValue<T>(value: T): T { | 324 | 318 | return value; | 325 | 319 | } | 326 | 320 |
| 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 | | - } | 336 | | - hookLog.push({ | 337 | | - primitive: 'OpaqueIdentifier', | 338 | | - stackError: new Error(), | 339 | | - value, | 340 | | - }); | 341 | | - return value; | 342 | | -} | 343 | | - | 344 | 321 | function useId(): string { | 345 | 322 | const hook = nextHook(); | 346 | 323 | const id = hook !== null ? hook.memoizedState : ''; | @@ -371,7 +348,6 @@ const Dispatcher: DispatcherType = { | 371 | 348 | useMutableSource, | 372 | 349 | useSyncExternalStore, | 373 | 350 | useDeferredValue, | 374 | | - useOpaqueIdentifier, | 375 | 351 | useId, | 376 | 352 | }; | 377 | 353 |
| @@ -767,8 +743,6 @@ export function inspectHooksOfFiber( | 767 | 743 | currentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; | 768 | 744 | } | 769 | 745 |
| 770 | | - currentFiber = fiber; | 771 | | - | 772 | 746 | if ( | 773 | 747 | fiber.tag !== FunctionComponent && | 774 | 748 | fiber.tag !== SimpleMemoComponent && | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js -58Lines changed: 0 additions & 58 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -598,64 +598,6 @@ describe('ReactHooksInspectionIntegration', () => { | 598 | 598 | ]); | 599 | 599 | }); | 600 | 600 |
| 601 | | - it('should support composite useOpaqueIdentifier hook', () => { | 602 | | - function Foo(props) { | 603 | | - const id = React.unstable_useOpaqueIdentifier(); | 604 | | - const [state] = React.useState(() => 'hello', []); | 605 | | - return <div id={id}>{state}</div>; | 606 | | - } | 607 | | - | 608 | | - const renderer = ReactTestRenderer.create(<Foo />); | 609 | | - const childFiber = renderer.root.findByType(Foo)._currentFiber(); | 610 | | - const tree = ReactDebugTools.inspectHooksOfFiber(childFiber); | 611 | | - | 612 | | - expect(tree.length).toEqual(2); | 613 | | - | 614 | | - expect(tree[0].id).toEqual(0); | 615 | | - 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); | 649 | | - | 650 | | - expect(tree[1]).toEqual({ | 651 | | - id: 1, | 652 | | - isStateEditable: true, | 653 | | - name: 'State', | 654 | | - value: 'hello', | 655 | | - subHooks: [], | 656 | | - }); | 657 | | - }); | 658 | | - | 659 | 601 | it('should support useId hook', () => { | 660 | 602 | function Foo(props) { | 661 | 603 | const id = React.unstable_useId(); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-devtools-shared/src/backend/ReactSymbols.js -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,9 +40,6 @@ export const LAZY_SYMBOL_STRING = 'Symbol(react.lazy)'; | 40 | 40 | export const MEMO_NUMBER = 0xead3; | 41 | 41 | export const MEMO_SYMBOL_STRING = 'Symbol(react.memo)'; | 42 | 42 |
| 43 | | -export const OPAQUE_ID_NUMBER = 0xeae0; | 44 | | -export const OPAQUE_ID_SYMBOL_STRING = 'Symbol(react.opaque.id)'; | 45 | | - | 46 | 43 | export const PORTAL_NUMBER = 0xeaca; | 47 | 44 | export const PORTAL_SYMBOL_STRING = 'Symbol(react.portal)'; | 48 | 45 |
| |
|