mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Rename contextTag -> internalContextTag
This commit is contained in:
@@ -307,7 +307,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
// Insert
|
||||
const created = createFiberFromText(textContent, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
} else {
|
||||
// Update
|
||||
@@ -329,7 +329,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
const created = createFiberFromElement(element, priority);
|
||||
created.ref = coerceRef(current, element);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
} else {
|
||||
// Move based on index
|
||||
@@ -356,7 +356,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
// Insert
|
||||
const created = createFiberFromCoroutine(coroutine, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
} else {
|
||||
// Move based on index
|
||||
@@ -378,7 +378,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
const created = createFiberFromYield(yieldNode, priority);
|
||||
created.type = yieldNode.value;
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
} else {
|
||||
// Move based on index
|
||||
@@ -404,7 +404,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
// Insert
|
||||
const created = createFiberFromPortal(portal, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
} else {
|
||||
// Update
|
||||
@@ -425,7 +425,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
// Insert
|
||||
const created = createFiberFromFragment(fragment, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
} else {
|
||||
// Update
|
||||
@@ -447,7 +447,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
// node.
|
||||
const created = createFiberFromText('' + newChild, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -457,14 +457,14 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
const created = createFiberFromElement(newChild, priority);
|
||||
created.ref = coerceRef(null, newChild);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
case REACT_COROUTINE_TYPE: {
|
||||
const created = createFiberFromCoroutine(newChild, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -472,14 +472,14 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
const created = createFiberFromYield(newChild, priority);
|
||||
created.type = newChild.value;
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
case REACT_PORTAL_TYPE: {
|
||||
const created = createFiberFromPortal(newChild, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
}
|
||||
@@ -487,7 +487,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
if (isArray(newChild) || getIteratorFn(newChild)) {
|
||||
const created = createFiberFromFragment(newChild, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -1025,7 +1025,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
deleteRemainingChildren(returnFiber, currentFirstChild);
|
||||
const created = createFiberFromText(textContent, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -1065,7 +1065,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
const created = createFiberFromElement(element, priority);
|
||||
created.ref = coerceRef(currentFirstChild, element);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
|
||||
const created = createFiberFromCoroutine(coroutine, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -1126,7 +1126,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
const created = createFiberFromYield(yieldNode, priority);
|
||||
created.type = yieldNode.value;
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
@@ -1164,7 +1164,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
||||
|
||||
const created = createFiberFromPortal(portal, priority);
|
||||
created.return = returnFiber;
|
||||
created.contextTag = returnFiber.contextTag;
|
||||
created.internalContextTag = returnFiber.internalContextTag;
|
||||
return created;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import type {ReactFragment} from 'ReactTypes';
|
||||
import type {ReactCoroutine, ReactYield} from 'ReactCoroutine';
|
||||
import type {ReactPortal} from 'ReactPortal';
|
||||
import type {TypeOfWork} from 'ReactTypeOfWork';
|
||||
import type {TypeOfContext} from 'ReactTypeOfContext';
|
||||
import type {TypeOfInternalContext} from 'ReactTypeOfInternalContext';
|
||||
import type {TypeOfSideEffect} from 'ReactTypeOfSideEffect';
|
||||
import type {PriorityLevel} from 'ReactPriorityLevel';
|
||||
import type {UpdateQueue} from 'ReactFiberUpdateQueue';
|
||||
@@ -39,7 +39,7 @@ var {NoWork} = require('ReactPriorityLevel');
|
||||
|
||||
var {
|
||||
NoContext,
|
||||
} = require('ReactTypeOfContext');
|
||||
} = require('ReactTypeOfInternalContext');
|
||||
|
||||
var {
|
||||
NoEffect,
|
||||
@@ -116,13 +116,13 @@ export type Fiber = {
|
||||
// The state used to create the output
|
||||
memoizedState: any,
|
||||
|
||||
// Bitmask that describes properties about the fiber and its subtree. E.g. the
|
||||
// AsyncUpdates flag indicates whether the subtree should be async-by-default.
|
||||
// When a fiber is created, it inherits the contextTag of its parent.
|
||||
// Additional flags can be set at creation time, but after than
|
||||
// the value should remain unchanged throughout the fiber's lifetime,
|
||||
// particularly before its child fibers are created.
|
||||
contextTag: TypeOfContext,
|
||||
// Bitfield that describes properties about the fiber and its subtree. E.g.
|
||||
// the AsyncUpdates flag indicates whether the subtree should be async-by-
|
||||
// default. When a fiber is created, it inherits the internalContextTag of its
|
||||
// parent. Additional flags can be set at creation time, but after than the
|
||||
// value should remain unchanged throughout the fiber's lifetime, particularly
|
||||
// before its child fibers are created.
|
||||
internalContextTag: TypeOfInternalContext,
|
||||
|
||||
// Effect
|
||||
effectTag: TypeOfSideEffect,
|
||||
@@ -211,7 +211,7 @@ var createFiber = function(tag: TypeOfWork, key: null | string): Fiber {
|
||||
updateQueue: null,
|
||||
memoizedState: null,
|
||||
|
||||
contextTag: NoContext,
|
||||
internalContextTag: NoContext,
|
||||
|
||||
effectTag: NoEffect,
|
||||
nextEffect: null,
|
||||
@@ -298,7 +298,7 @@ exports.cloneFiber = function(
|
||||
alt.memoizedProps = fiber.memoizedProps;
|
||||
alt.memoizedState = fiber.memoizedState;
|
||||
|
||||
alt.contextTag = fiber.contextTag;
|
||||
alt.internalContextTag = fiber.internalContextTag;
|
||||
|
||||
if (__DEV__) {
|
||||
alt._debugID = fiber._debugID;
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
import type {Fiber} from 'ReactFiber';
|
||||
import type {PriorityLevel} from 'ReactPriorityLevel';
|
||||
|
||||
var {
|
||||
AsyncUpdates,
|
||||
} = require('ReactTypeOfInternalContext');
|
||||
var {
|
||||
Update,
|
||||
} = require('ReactTypeOfSideEffect');
|
||||
@@ -306,7 +309,7 @@ module.exports = function(
|
||||
instance.context = getMaskedContext(workInProgress, unmaskedContext);
|
||||
|
||||
if (instance.unstable_asyncUpdates === true) {
|
||||
workInProgress.contextTag |= AsyncUpdates;
|
||||
workInProgress.internalContextTag |= AsyncUpdates;
|
||||
}
|
||||
|
||||
if (typeof instance.componentWillMount === 'function') {
|
||||
|
||||
@@ -17,6 +17,10 @@ import type {FiberRoot} from 'ReactFiberRoot';
|
||||
import type {PriorityLevel} from 'ReactPriorityLevel';
|
||||
import type {ReactNodeList} from 'ReactTypes';
|
||||
|
||||
var {
|
||||
AsyncUpdates,
|
||||
} = require('ReactTypeOfInternalContext');
|
||||
|
||||
var {
|
||||
addTopLevelUpdate,
|
||||
} = require('ReactFiberUpdateQueue');
|
||||
@@ -214,7 +218,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
|
||||
// TODO: Make messages more user-friendly?
|
||||
if (__DEV__) {
|
||||
warning(
|
||||
!async || container.current.contextTag & AsyncUpdates,
|
||||
!async || container.current.internalContextTag & AsyncUpdates,
|
||||
'Attempted to schedule an asynchronous update on a sync container.',
|
||||
);
|
||||
}
|
||||
@@ -251,7 +255,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
|
||||
|
||||
createAsyncContainer(containerInfo: C): OpaqueRoot {
|
||||
const fiberRoot = createFiberRoot(containerInfo);
|
||||
fiberRoot.current.contextTag |= AsyncUpdates;
|
||||
fiberRoot.current.internalContextTag |= AsyncUpdates;
|
||||
return fiberRoot;
|
||||
},
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ var {
|
||||
|
||||
var {
|
||||
AsyncUpdates,
|
||||
} = require('ReactTypeOfContext');
|
||||
} = require('ReactTypeOfInternalContext');
|
||||
|
||||
var {
|
||||
NoEffect,
|
||||
@@ -1350,7 +1350,7 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
|
||||
if (priorityLevel === NoWork) {
|
||||
if (
|
||||
!useSyncScheduling ||
|
||||
(enableAsyncSubtreeAPI === true && fiber.contextTag & AsyncUpdates)
|
||||
(enableAsyncSubtreeAPI === true && fiber.internalContextTag & AsyncUpdates)
|
||||
) {
|
||||
priorityLevel = LowPriority;
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -6,13 +6,13 @@
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ReactTypeOfContext
|
||||
* @providesModule ReactTypeOfInternalContext
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
export type TypeOfContext = 0 | 1;
|
||||
export type TypeOfInternalContext = 0 | 1;
|
||||
|
||||
module.exports = {
|
||||
NoContext: 0,
|
||||
Reference in New Issue
Block a user