@samitouri / QOS-React-2 / commits / 340bfd9393

Rename ReactTypeOfWork to ReactWorkTags, ReactTypeOfSideEffect to ReactSideEffectTags (#13476)

* Rename ReactTypeOfWork to ReactWorkTags And `type TypeOfWork` to `type WorkTag`. * Rename ReactTypeOfSideEffect too

Sophie Alpert committed Aug 26, 2018 at 13:40 UTC 340bfd9393e8173adca5380e6587e1ea1a23cefa
25 files changed +42 -46
packages/events/__tests__/ResponderEventPlugin-test.internal.js
+1 -1
@@ -9,7 +9,7 @@
9
10 'use strict';
11
12 -const {HostComponent} = require('shared/ReactTypeOfWork');
12 +const {HostComponent} = require('shared/ReactWorkTags');
13
14 let EventPluginHub;
15 let ResponderEventPlugin;
packages/react-dom/src/client/ReactDOMComponentTree.js
+1 -1
@@ -5,7 +5,7 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -import {HostComponent, HostText} from 'shared/ReactTypeOfWork';
8 +import {HostComponent, HostText} from 'shared/ReactWorkTags';
9 import invariant from 'shared/invariant';
10
11 const randomKey = Math.random()
packages/react-dom/src/events/ReactDOMEventListener.js
+1 -1
@@ -14,7 +14,7 @@ import type {DOMTopLevelEventType} from 'events/TopLevelEventTypes';
14 import {batchedUpdates, interactiveUpdates} from 'events/ReactGenericBatching';
15 import {runExtractedEventsInBatch} from 'events/EventPluginHub';
16 import {isFiberMounted} from 'react-reconciler/reflection';
17 -import {HostRoot} from 'shared/ReactTypeOfWork';
17 +import {HostRoot} from 'shared/ReactWorkTags';
18
19 import {addEventBubbleListener, addEventCaptureListener} from './EventListener';
20 import getEventTarget from './getEventTarget';
packages/react-dom/src/test-utils/ReactTestUtils.js
+1 -1
@@ -16,7 +16,7 @@ import {
16 FunctionalComponentLazy,
17 HostComponent,
18 HostText,
19 -} from 'shared/ReactTypeOfWork';
19 +} from 'shared/ReactWorkTags';
20 import SyntheticEvent from 'events/SyntheticEvent';
21 import invariant from 'shared/invariant';
22 import lowPriorityWarning from 'shared/lowPriorityWarning';
packages/react-native-renderer/src/ReactNativeFiberInspector.js
+1 -1
@@ -14,7 +14,7 @@ import {
14 findCurrentFiberUsingSlowPath,
15 } from 'react-reconciler/reflection';
16 import getComponentName from 'shared/getComponentName';
17 -import {HostComponent} from 'shared/ReactTypeOfWork';
17 +import {HostComponent} from 'shared/ReactWorkTags';
18 import invariant from 'shared/invariant';
19 // Module provided by RN:
20 import UIManager from 'UIManager';
packages/react-reconciler/src/ReactChildFiber.js
+2 -2
@@ -13,7 +13,7 @@ import type {Fiber} from 'react-reconciler/src/ReactFiber';
13 import type {ExpirationTime} from 'react-reconciler/src/ReactFiberExpirationTime';
14
15 import getComponentName from 'shared/getComponentName';
16 -import {Placement, Deletion} from 'shared/ReactTypeOfSideEffect';
16 +import {Placement, Deletion} from 'shared/ReactSideEffectTags';
17 import {
18 getIteratorFn,
19 REACT_ELEMENT_TYPE,
@@ -27,7 +27,7 @@ import {
27 HostText,
28 HostPortal,
29 Fragment,
30 -} from 'shared/ReactTypeOfWork';
30 +} from 'shared/ReactWorkTags';
31 import invariant from 'shared/invariant';
32 import warning from 'shared/warning';
33 import warningWithoutStack from 'shared/warningWithoutStack';
packages/react-reconciler/src/ReactCurrentFiber.js
+1 -1
@@ -16,7 +16,7 @@ import {
16 ClassComponentLazy,
17 HostComponent,
18 Mode,
19 -} from 'shared/ReactTypeOfWork';
19 +} from 'shared/ReactWorkTags';
20 import describeComponentFrame from 'shared/describeComponentFrame';
21 import getComponentName from 'shared/getComponentName';
22
packages/react-reconciler/src/ReactDebugFiberPerf.js
+1 -1
@@ -20,7 +20,7 @@ import {
20 ContextProvider,
21 ContextConsumer,
22 Mode,
23 -} from 'shared/ReactTypeOfWork';
23 +} from 'shared/ReactWorkTags';
24
25 type MeasurementPhase =
26 | 'componentWillMount'
packages/react-reconciler/src/ReactFiber.js
+9 -9
@@ -9,16 +9,16 @@
9
10 import type {ReactElement, Source} from 'shared/ReactElementType';
11 import type {ReactFragment, ReactPortal, RefObject} from 'shared/ReactTypes';
12 -import type {TypeOfWork} from 'shared/ReactTypeOfWork';
12 +import type {WorkTag} from 'shared/ReactWorkTags';
13 import type {TypeOfMode} from './ReactTypeOfMode';
14 -import type {TypeOfSideEffect} from 'shared/ReactTypeOfSideEffect';
14 +import type {SideEffectTag} from 'shared/ReactSideEffectTags';
15 import type {ExpirationTime} from './ReactFiberExpirationTime';
16 import type {UpdateQueue} from './ReactUpdateQueue';
17 import type {ContextDependency} from './ReactFiberNewContext';
18
19 import invariant from 'shared/invariant';
20 import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
21 -import {NoEffect} from 'shared/ReactTypeOfSideEffect';
21 +import {NoEffect} from 'shared/ReactSideEffectTags';
22 import {
23 IndeterminateComponent,
24 ClassComponent,
@@ -36,7 +36,7 @@ import {
36 FunctionalComponentLazy,
37 ClassComponentLazy,
38 ForwardRefLazy,
39 -} from 'shared/ReactTypeOfWork';
39 +} from 'shared/ReactWorkTags';
40 import getComponentName from 'shared/getComponentName';
41
42 import {isDevToolsPresent} from './ReactFiberDevToolsHook';
@@ -86,7 +86,7 @@ export type Fiber = {|
86 // minimize the number of objects created during the initial render.
87
88 // Tag identifying the type of fiber.
89 - tag: TypeOfWork,
89 + tag: WorkTag,
90
91 // Unique identifier of this child.
92 key: null | string,
@@ -140,7 +140,7 @@ export type Fiber = {|
140 mode: TypeOfMode,
141
142 // Effect
143 - effectTag: TypeOfSideEffect,
143 + effectTag: SideEffectTag,
144
145 // Singly linked list fast path to the next fiber with side-effects.
146 nextEffect: Fiber | null,
@@ -201,7 +201,7 @@ if (__DEV__) {
201 }
202
203 function FiberNode(
204 - tag: TypeOfWork,
204 + tag: WorkTag,
205 pendingProps: mixed,
206 key: null | string,
207 mode: TypeOfMode,
@@ -272,7 +272,7 @@ function FiberNode(
272 // 5) It should be easy to port this to a C struct and keep a C implementation
273 // compatible.
274 const createFiber = function(
275 - tag: TypeOfWork,
275 + tag: WorkTag,
276 pendingProps: mixed,
277 key: null | string,
278 mode: TypeOfMode,
@@ -294,7 +294,7 @@ function shouldConstruct(Component: Function) {
294 export function resolveLazyComponentTag(
295 fiber: Fiber,
296 Component: Function,
297 -): TypeOfWork {
297 +): WorkTag {
298 if (typeof Component === 'function') {
299 return shouldConstruct(Component)
300 ? ClassComponentLazy
packages/react-reconciler/src/ReactFiberBeginWork.js
+2 -2
@@ -31,7 +31,7 @@ import {
31 ContextConsumer,
32 Profiler,
33 PlaceholderComponent,
34 -} from 'shared/ReactTypeOfWork';
34 +} from 'shared/ReactWorkTags';
35 import {
36 NoEffect,
37 PerformedWork,
@@ -40,7 +40,7 @@ import {
40 DidCapture,
41 Update,
42 Ref,
43 -} from 'shared/ReactTypeOfSideEffect';
43 +} from 'shared/ReactSideEffectTags';
44 import ReactSharedInternals from 'shared/ReactSharedInternals';
45 import {
46 enableGetDerivedStateFromCatch,
packages/react-reconciler/src/ReactFiberClassComponent.js
+1 -1
@@ -11,7 +11,7 @@ import type {Fiber} from './ReactFiber';
11 import type {ExpirationTime} from './ReactFiberExpirationTime';
12
13 import React from 'react';
14 -import {Update, Snapshot} from 'shared/ReactTypeOfSideEffect';
14 +import {Update, Snapshot} from 'shared/ReactSideEffectTags';
15 import {
16 debugRenderPhaseSideEffects,
17 debugRenderPhaseSideEffectsForStrictMode,
packages/react-reconciler/src/ReactFiberCommitWork.js
+2 -2
@@ -29,7 +29,7 @@ import {
29 HostPortal,
30 Profiler,
31 PlaceholderComponent,
32 -} from 'shared/ReactTypeOfWork';
32 +} from 'shared/ReactWorkTags';
33 import {
34 invokeGuardedCallback,
35 hasCaughtError,
@@ -41,7 +41,7 @@ import {
41 Placement,
42 Snapshot,
43 Update,
44 -} from 'shared/ReactTypeOfSideEffect';
44 +} from 'shared/ReactSideEffectTags';
45 import getComponentName from 'shared/getComponentName';
46 import invariant from 'shared/invariant';
47 import warningWithoutStack from 'shared/warningWithoutStack';
packages/react-reconciler/src/ReactFiberCompleteWork.js
+2 -2
@@ -38,8 +38,8 @@ import {
38 Profiler,
39 PlaceholderComponent,
40 ForwardRefLazy,
41 -} from 'shared/ReactTypeOfWork';
42 -import {Placement, Ref, Update} from 'shared/ReactTypeOfSideEffect';
41 +} from 'shared/ReactWorkTags';
42 +import {Placement, Ref, Update} from 'shared/ReactSideEffectTags';
43 import invariant from 'shared/invariant';
44 import {getResultFromResolvedThenable} from 'shared/ReactLazyComponent';
45
packages/react-reconciler/src/ReactFiberContext.js
+1 -1
@@ -15,7 +15,7 @@ import {
15 ClassComponent,
16 HostRoot,
17 ClassComponentLazy,
18 -} from 'shared/ReactTypeOfWork';
18 +} from 'shared/ReactWorkTags';
19 import getComponentName from 'shared/getComponentName';
20 import invariant from 'shared/invariant';
21 import warningWithoutStack from 'shared/warningWithoutStack';
packages/react-reconciler/src/ReactFiberHydrationContext.js
+2 -2
@@ -16,8 +16,8 @@ import type {
16 HostContext,
17 } from './ReactFiberHostConfig';
18
19 -import {HostComponent, HostText, HostRoot} from 'shared/ReactTypeOfWork';
20 -import {Deletion, Placement} from 'shared/ReactTypeOfSideEffect';
19 +import {HostComponent, HostText, HostRoot} from 'shared/ReactWorkTags';
20 +import {Deletion, Placement} from 'shared/ReactSideEffectTags';
21 import invariant from 'shared/invariant';
22
23 import {createFiberFromHostInstanceForDeletion} from './ReactFiber';
packages/react-reconciler/src/ReactFiberNewContext.js
+1 -1
@@ -27,7 +27,7 @@ import {
27 ContextProvider,
28 ClassComponent,
29 ClassComponentLazy,
30 -} from 'shared/ReactTypeOfWork';
30 +} from 'shared/ReactWorkTags';
31
32 import invariant from 'shared/invariant';
33 import warning from 'shared/warning';
packages/react-reconciler/src/ReactFiberReconciler.js
+1 -1
@@ -27,7 +27,7 @@ import {
27 HostComponent,
28 ClassComponent,
29 ClassComponentLazy,
30 -} from 'shared/ReactTypeOfWork';
30 +} from 'shared/ReactWorkTags';
31 import getComponentName from 'shared/getComponentName';
32 import invariant from 'shared/invariant';
33 import warningWithoutStack from 'shared/warningWithoutStack';
packages/react-reconciler/src/ReactFiberScheduler.js
+2 -2
@@ -32,7 +32,7 @@ import {
32 Ref,
33 Incomplete,
34 HostEffectMask,
35 -} from 'shared/ReactTypeOfSideEffect';
35 +} from 'shared/ReactSideEffectTags';
36 import {
37 HostRoot,
38 ClassComponent,
@@ -40,7 +40,7 @@ import {
40 HostComponent,
41 ContextProvider,
42 HostPortal,
43 -} from 'shared/ReactTypeOfWork';
43 +} from 'shared/ReactWorkTags';
44 import {
45 enableProfilerTimer,
46 enableUserTimingAPI,
packages/react-reconciler/src/ReactFiberTreeReflection.js
+2 -2
@@ -22,8 +22,8 @@ import {
22 HostRoot,
23 HostPortal,
24 HostText,
25 -} from 'shared/ReactTypeOfWork';
26 -import {NoEffect, Placement} from 'shared/ReactTypeOfSideEffect';
25 +} from 'shared/ReactWorkTags';
26 +import {NoEffect, Placement} from 'shared/ReactSideEffectTags';
27
28 const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
29
packages/react-reconciler/src/ReactFiberUnwindWork.js
+2 -2
@@ -24,7 +24,7 @@ import {
24 HostPortal,
25 ContextProvider,
26 PlaceholderComponent,
27 -} from 'shared/ReactTypeOfWork';
27 +} from 'shared/ReactWorkTags';
28 import {
29 DidCapture,
30 Incomplete,
@@ -32,7 +32,7 @@ import {
32 ShouldCapture,
33 Update as UpdateEffect,
34 LifecycleEffectMask,
35 -} from 'shared/ReactTypeOfSideEffect';
35 +} from 'shared/ReactSideEffectTags';
36 import {
37 enableGetDerivedStateFromCatch,
38 enableSuspense,
packages/react-reconciler/src/ReactUpdateQueue.js
+2 -6
@@ -88,12 +88,8 @@ import type {Fiber} from './ReactFiber';
88 import type {ExpirationTime} from './ReactFiberExpirationTime';
89
90 import {NoWork} from './ReactFiberExpirationTime';
91 -import {
92 - Callback,
93 - ShouldCapture,
94 - DidCapture,
95 -} from 'shared/ReactTypeOfSideEffect';
96 -import {ClassComponent, ClassComponentLazy} from 'shared/ReactTypeOfWork';
91 +import {Callback, ShouldCapture, DidCapture} from 'shared/ReactSideEffectTags';
92 +import {ClassComponent, ClassComponentLazy} from 'shared/ReactWorkTags';
93
94 import {
95 debugRenderPhaseSideEffects,
packages/react-test-renderer/src/ReactTestRenderer.js
+1 -1
@@ -30,7 +30,7 @@ import {
30 ForwardRef,
31 Profiler,
32 ForwardRefLazy,
33 -} from 'shared/ReactTypeOfWork';
33 +} from 'shared/ReactWorkTags';
34 import invariant from 'shared/invariant';
35 import ReactVersion from 'shared/ReactVersion';
36
packages/shared/ReactSideEffectTags.js renamed
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -export type TypeOfSideEffect = number;
10 +export type SideEffectTag = number;
11
12 // Don't change these two values. They're used by React Dev Tools.
13 export const NoEffect = /* */ 0b00000000000;
packages/shared/ReactTreeTraversal.js
+1 -1
@@ -5,7 +5,7 @@
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 -import {HostComponent} from './ReactTypeOfWork';
8 +import {HostComponent} from './ReactWorkTags';
9
10 function getParent(inst) {
11 do {
packages/shared/ReactWorkTags.js renamed
+1 -1
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -export type TypeOfWork =
10 +export type WorkTag =
11 | 0
12 | 1
13 | 2