Skip to content

Commit 4ecf119

Browse files
authored
Remove the Fundamental internals (#20745)
1 parent eeb1325 commit 4ecf119

Some content is hidden

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

41 files changed

+12
-1092
lines changed

packages/react-art/src/ReactARTHostConfig.js

-20
Original file line numberDiff line numberDiff line change
@@ -428,26 +428,6 @@ export function clearContainer(container) {
428428
// TODO Implement this
429429
}
430430

431-
export function getFundamentalComponentInstance(fundamentalInstance) {
432-
throw new Error('Not yet implemented.');
433-
}
434-
435-
export function mountFundamentalComponent(fundamentalInstance) {
436-
throw new Error('Not yet implemented.');
437-
}
438-
439-
export function shouldUpdateFundamentalComponent(fundamentalInstance) {
440-
throw new Error('Not yet implemented.');
441-
}
442-
443-
export function updateFundamentalComponent(fundamentalInstance) {
444-
throw new Error('Not yet implemented.');
445-
}
446-
447-
export function unmountFundamentalComponent(fundamentalInstance) {
448-
throw new Error('Not yet implemented.');
449-
}
450-
451431
export function getInstanceFromNode(node) {
452432
throw new Error('Not yet implemented.');
453433
}

packages/react-devtools-shared/src/backend/ReactSymbols.js

-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export const FORWARD_REF_SYMBOL_STRING = 'Symbol(react.forward_ref)';
3434
export const FRAGMENT_NUMBER = 0xeacb;
3535
export const FRAGMENT_SYMBOL_STRING = 'Symbol(react.fragment)';
3636

37-
export const FUNDAMENTAL_NUMBER = 0xead5;
38-
export const FUNDAMENTAL_SYMBOL_STRING = 'Symbol(react.fundamental)';
39-
4037
export const LAZY_NUMBER = 0xead4;
4138
export const LAZY_SYMBOL_STRING = 'Symbol(react.lazy)';
4239

packages/react-dom/src/client/ReactDOMHostConfig.js

-64
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import type {
1616
} from 'react-reconciler/src/ReactTestSelectors';
1717
import type {RootType} from './ReactDOMRoot';
1818
import type {ReactScopeInstance} from 'shared/ReactTypes';
19-
import type {ReactDOMFundamentalComponentInstance} from '../shared/ReactDOMTypes';
2019

2120
import {
2221
precacheFiberNode,
@@ -64,7 +63,6 @@ import {retryIfBlockedOn} from '../events/ReactDOMEventReplaying';
6463

6564
import {
6665
enableSuspenseServerRenderer,
67-
enableFundamentalAPI,
6866
enableCreateEventHandleAPI,
6967
enableScopeAPI,
7068
} from 'shared/ReactFeatureFlags';
@@ -988,68 +986,6 @@ export function didNotFindHydratableSuspenseInstance(
988986
}
989987
}
990988

991-
export function getFundamentalComponentInstance(
992-
fundamentalInstance: ReactDOMFundamentalComponentInstance,
993-
): Instance {
994-
if (enableFundamentalAPI) {
995-
const {currentFiber, impl, props, state} = fundamentalInstance;
996-
const instance = impl.getInstance(null, props, state);
997-
precacheFiberNode(currentFiber, instance);
998-
return instance;
999-
}
1000-
// Because of the flag above, this gets around the Flow error;
1001-
return (null: any);
1002-
}
1003-
1004-
export function mountFundamentalComponent(
1005-
fundamentalInstance: ReactDOMFundamentalComponentInstance,
1006-
): void {
1007-
if (enableFundamentalAPI) {
1008-
const {impl, instance, props, state} = fundamentalInstance;
1009-
const onMount = impl.onMount;
1010-
if (onMount !== undefined) {
1011-
onMount(null, instance, props, state);
1012-
}
1013-
}
1014-
}
1015-
1016-
export function shouldUpdateFundamentalComponent(
1017-
fundamentalInstance: ReactDOMFundamentalComponentInstance,
1018-
): boolean {
1019-
if (enableFundamentalAPI) {
1020-
const {impl, prevProps, props, state} = fundamentalInstance;
1021-
const shouldUpdate = impl.shouldUpdate;
1022-
if (shouldUpdate !== undefined) {
1023-
return shouldUpdate(null, prevProps, props, state);
1024-
}
1025-
}
1026-
return true;
1027-
}
1028-
1029-
export function updateFundamentalComponent(
1030-
fundamentalInstance: ReactDOMFundamentalComponentInstance,
1031-
): void {
1032-
if (enableFundamentalAPI) {
1033-
const {impl, instance, prevProps, props, state} = fundamentalInstance;
1034-
const onUpdate = impl.onUpdate;
1035-
if (onUpdate !== undefined) {
1036-
onUpdate(null, instance, prevProps, props, state);
1037-
}
1038-
}
1039-
}
1040-
1041-
export function unmountFundamentalComponent(
1042-
fundamentalInstance: ReactDOMFundamentalComponentInstance,
1043-
): void {
1044-
if (enableFundamentalAPI) {
1045-
const {impl, instance, props, state} = fundamentalInstance;
1046-
const onUnmount = impl.onUnmount;
1047-
if (onUnmount !== undefined) {
1048-
onUnmount(null, instance, props, state);
1049-
}
1050-
}
1051-
}
1052-
1053989
export function getInstanceFromNode(node: HTMLElement): null | Object {
1054990
return getClosestInstanceFromNode(node) || null;
1055991
}

packages/react-dom/src/server/ReactPartialRenderer.js

-39
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
disableLegacyContext,
2323
disableModulePatternComponents,
2424
enableSuspenseServerRenderer,
25-
enableFundamentalAPI,
2625
enableScopeAPI,
2726
} from 'shared/ReactFeatureFlags';
2827

@@ -39,7 +38,6 @@ import {
3938
REACT_CONTEXT_TYPE,
4039
REACT_LAZY_TYPE,
4140
REACT_MEMO_TYPE,
42-
REACT_FUNDAMENTAL_TYPE,
4341
REACT_SCOPE_TYPE,
4442
REACT_LEGACY_HIDDEN_TYPE,
4543
} from 'shared/ReactSymbols';
@@ -1253,43 +1251,6 @@ class ReactDOMServerRenderer {
12531251
return '';
12541252
}
12551253
// eslint-disable-next-line-no-fallthrough
1256-
case REACT_FUNDAMENTAL_TYPE: {
1257-
if (enableFundamentalAPI) {
1258-
const fundamentalImpl = elementType.impl;
1259-
const open = fundamentalImpl.getServerSideString(
1260-
null,
1261-
nextElement.props,
1262-
);
1263-
const getServerSideStringClose =
1264-
fundamentalImpl.getServerSideStringClose;
1265-
const close =
1266-
getServerSideStringClose !== undefined
1267-
? getServerSideStringClose(null, nextElement.props)
1268-
: '';
1269-
const nextChildren =
1270-
fundamentalImpl.reconcileChildren !== false
1271-
? toArray(((nextChild: any): ReactElement).props.children)
1272-
: [];
1273-
const frame: Frame = {
1274-
type: null,
1275-
domNamespace: parentNamespace,
1276-
children: nextChildren,
1277-
childIndex: 0,
1278-
context: context,
1279-
footer: close,
1280-
};
1281-
if (__DEV__) {
1282-
((frame: any): FrameDev).debugElementStack = [];
1283-
}
1284-
this.stack.push(frame);
1285-
return open;
1286-
}
1287-
invariant(
1288-
false,
1289-
'ReactDOMServer does not yet support the fundamental API.',
1290-
);
1291-
}
1292-
// eslint-disable-next-line-no-fallthrough
12931254
case REACT_LAZY_TYPE: {
12941255
const element: ReactElement = (nextChild: any);
12951256
const lazyComponent: LazyComponent<any, any> = (nextChild: any)

packages/react-dom/src/shared/ReactDOMTypes.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@
77
* @flow
88
*/
99

10-
import type {
11-
ReactFundamentalComponentInstance,
12-
ReactScopeInstance,
13-
} from 'shared/ReactTypes';
10+
import type {ReactScopeInstance} from 'shared/ReactTypes';
1411
import type {DOMEventName} from '../events/DOMEventNames';
1512

16-
export type ReactDOMFundamentalComponentInstance = ReactFundamentalComponentInstance<
17-
any,
18-
any,
19-
>;
20-
2113
export type ReactDOMEventHandle = (
2214
target: EventTarget | ReactScopeInstance,
2315
callback: (SyntheticEvent<EventTarget>) => void,

packages/react-native-renderer/src/ReactFabricHostConfig.js

-24
Original file line numberDiff line numberDiff line change
@@ -438,30 +438,6 @@ export function replaceContainerChildren(
438438
newChildren: ChildSet,
439439
): void {}
440440

441-
export function getFundamentalComponentInstance(fundamentalInstance: any) {
442-
throw new Error('Not yet implemented.');
443-
}
444-
445-
export function mountFundamentalComponent(fundamentalInstance: any) {
446-
throw new Error('Not yet implemented.');
447-
}
448-
449-
export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
450-
throw new Error('Not yet implemented.');
451-
}
452-
453-
export function updateFundamentalComponent(fundamentalInstance: any) {
454-
throw new Error('Not yet implemented.');
455-
}
456-
457-
export function unmountFundamentalComponent(fundamentalInstance: any) {
458-
throw new Error('Not yet implemented.');
459-
}
460-
461-
export function cloneFundamentalInstance(fundamentalInstance: any) {
462-
throw new Error('Not yet implemented.');
463-
}
464-
465441
export function getInstanceFromNode(node: any) {
466442
throw new Error('Not yet implemented.');
467443
}

packages/react-native-renderer/src/ReactNativeHostConfig.js

-20
Original file line numberDiff line numberDiff line change
@@ -495,26 +495,6 @@ export function unhideTextInstance(
495495
throw new Error('Not yet implemented.');
496496
}
497497

498-
export function getFundamentalComponentInstance(fundamentalInstance: any) {
499-
throw new Error('Not yet implemented.');
500-
}
501-
502-
export function mountFundamentalComponent(fundamentalInstance: any) {
503-
throw new Error('Not yet implemented.');
504-
}
505-
506-
export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
507-
throw new Error('Not yet implemented.');
508-
}
509-
510-
export function updateFundamentalComponent(fundamentalInstance: any) {
511-
throw new Error('Not yet implemented.');
512-
}
513-
514-
export function unmountFundamentalComponent(fundamentalInstance: any) {
515-
throw new Error('Not yet implemented.');
516-
}
517-
518498
export function getInstanceFromNode(node: any) {
519499
throw new Error('Not yet implemented.');
520500
}

packages/react-noop-renderer/src/createReactNoop.js

-51
Original file line numberDiff line numberDiff line change
@@ -397,57 +397,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
397397
warnsIfNotActing: true,
398398
supportsHydration: false,
399399

400-
getFundamentalComponentInstance(fundamentalInstance): Instance {
401-
const {impl, props, state} = fundamentalInstance;
402-
return impl.getInstance(null, props, state);
403-
},
404-
405-
mountFundamentalComponent(fundamentalInstance): void {
406-
const {impl, instance, props, state} = fundamentalInstance;
407-
const onMount = impl.onUpdate;
408-
if (onMount !== undefined) {
409-
onMount(null, instance, props, state);
410-
}
411-
},
412-
413-
shouldUpdateFundamentalComponent(fundamentalInstance): boolean {
414-
const {impl, instance, prevProps, props, state} = fundamentalInstance;
415-
const shouldUpdate = impl.shouldUpdate;
416-
if (shouldUpdate !== undefined) {
417-
return shouldUpdate(null, instance, prevProps, props, state);
418-
}
419-
return true;
420-
},
421-
422-
updateFundamentalComponent(fundamentalInstance): void {
423-
const {impl, instance, prevProps, props, state} = fundamentalInstance;
424-
const onUpdate = impl.onUpdate;
425-
if (onUpdate !== undefined) {
426-
onUpdate(null, instance, prevProps, props, state);
427-
}
428-
},
429-
430-
unmountFundamentalComponent(fundamentalInstance): void {
431-
const {impl, instance, props, state} = fundamentalInstance;
432-
const onUnmount = impl.onUnmount;
433-
if (onUnmount !== undefined) {
434-
onUnmount(null, instance, props, state);
435-
}
436-
},
437-
438-
cloneFundamentalInstance(fundamentalInstance): Instance {
439-
const instance = fundamentalInstance.instance;
440-
return {
441-
children: [],
442-
text: instance.text,
443-
type: instance.type,
444-
prop: instance.prop,
445-
id: instance.id,
446-
context: instance.context,
447-
hidden: instance.hidden,
448-
};
449-
},
450-
451400
getInstanceFromNode() {
452401
throw new Error('Not yet implemented.');
453402
},

packages/react-reconciler/src/ReactFiber.new.js

+1-34
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88
*/
99

1010
import type {ReactElement} from 'shared/ReactElementType';
11-
import type {
12-
ReactFragment,
13-
ReactPortal,
14-
ReactFundamentalComponent,
15-
ReactScope,
16-
} from 'shared/ReactTypes';
11+
import type {ReactFragment, ReactPortal, ReactScope} from 'shared/ReactTypes';
1712
import type {Fiber} from './ReactInternalTypes';
1813
import type {RootTag} from './ReactRootTags';
1914
import type {WorkTag} from './ReactWorkTags';
@@ -25,7 +20,6 @@ import type {OffscreenProps} from './ReactFiberOffscreenComponent';
2520
import invariant from 'shared/invariant';
2621
import {
2722
enableProfilerTimer,
28-
enableFundamentalAPI,
2923
enableScopeAPI,
3024
enableCache,
3125
} from 'shared/ReactFeatureFlags';
@@ -51,7 +45,6 @@ import {
5145
MemoComponent,
5246
SimpleMemoComponent,
5347
LazyComponent,
54-
FundamentalComponent,
5548
ScopeComponent,
5649
OffscreenComponent,
5750
LegacyHiddenComponent,
@@ -86,7 +79,6 @@ import {
8679
REACT_SUSPENSE_LIST_TYPE,
8780
REACT_MEMO_TYPE,
8881
REACT_LAZY_TYPE,
89-
REACT_FUNDAMENTAL_TYPE,
9082
REACT_SCOPE_TYPE,
9183
REACT_OFFSCREEN_TYPE,
9284
REACT_LEGACY_HIDDEN_TYPE,
@@ -525,17 +517,6 @@ export function createFiberFromTypeAndProps(
525517
fiberTag = LazyComponent;
526518
resolvedType = null;
527519
break getTag;
528-
case REACT_FUNDAMENTAL_TYPE:
529-
if (enableFundamentalAPI) {
530-
return createFiberFromFundamental(
531-
type,
532-
pendingProps,
533-
mode,
534-
lanes,
535-
key,
536-
);
537-
}
538-
break;
539520
}
540521
}
541522
let info = '';
@@ -618,20 +599,6 @@ export function createFiberFromFragment(
618599
return fiber;
619600
}
620601

621-
export function createFiberFromFundamental(
622-
fundamentalComponent: ReactFundamentalComponent<any, any>,
623-
pendingProps: any,
624-
mode: TypeOfMode,
625-
lanes: Lanes,
626-
key: null | string,
627-
): Fiber {
628-
const fiber = createFiber(FundamentalComponent, pendingProps, key, mode);
629-
fiber.elementType = fundamentalComponent;
630-
fiber.type = fundamentalComponent;
631-
fiber.lanes = lanes;
632-
return fiber;
633-
}
634-
635602
function createFiberFromScope(
636603
scope: ReactScope,
637604
pendingProps: any,

0 commit comments

Comments
 (0)