Skip to content

Commit

Permalink
Change "_secondary" suffix to "2"
Browse files Browse the repository at this point in the history
#EveryBitCounts
  • Loading branch information
acdlite committed May 11, 2018
1 parent af82611 commit 82255ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
26 changes: 11 additions & 15 deletions packages/react-reconciler/src/ReactFiberNewContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ export default function(stack: Stack, isPrimaryRenderer: boolean) {
context._currentRenderer = rendererSigil;
}
} else {
push(changedBitsCursor, context._changedBits_secondary, providerFiber);
push(valueCursor, context._currentValue_secondary, providerFiber);
push(changedBitsCursor, context._changedBits2, providerFiber);
push(valueCursor, context._currentValue2, providerFiber);
push(providerCursor, providerFiber, providerFiber);

context._currentValue_secondary = providerFiber.pendingProps.value;
context._changedBits_secondary = providerFiber.stateNode;
context._currentValue2 = providerFiber.pendingProps.value;
context._changedBits2 = providerFiber.stateNode;
if (__DEV__) {
warning(
context._currentRenderer_secondary === null ||
context._currentRenderer_secondary === rendererSigil,
context._currentRenderer2 === null ||
context._currentRenderer2 === rendererSigil,
'Detected multiple renderers concurrently rendering the ' +
'same context provider. This is currently unsupported.',
);
context._currentRenderer_secondary = rendererSigil;
context._currentRenderer2 = rendererSigil;
}
}
}
Expand All @@ -84,21 +84,17 @@ export default function(stack: Stack, isPrimaryRenderer: boolean) {
context._currentValue = currentValue;
context._changedBits = changedBits;
} else {
context._currentValue_secondary = currentValue;
context._changedBits_secondary = changedBits;
context._currentValue2 = currentValue;
context._changedBits2 = changedBits;
}
}

function getContextCurrentValue(context: ReactContext<any>): any {
return isPrimaryRenderer
? context._currentValue
: context._currentValue_secondary;
return isPrimaryRenderer ? context._currentValue : context._currentValue2;
}

function getContextChangedBits(context: ReactContext<any>): number {
return isPrimaryRenderer
? context._changedBits
: context._changedBits_secondary;
return isPrimaryRenderer ? context._changedBits : context._changedBits2;
}

return {
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/ReactContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export function createContext<T>(
// there to be two concurrent renderers at most: React Native (primary) and
// Fabric (secondary); React DOM (primary) and React ART (secondary).
// Secondary renderers store their context values on separate fields.
_currentValue_secondary: defaultValue,
_currentValue2: defaultValue,
_changedBits: 0,
_changedBits_secondary: 0,
_changedBits2: 0,
// These are circular
Provider: (null: any),
Consumer: (null: any),
Expand All @@ -57,7 +57,7 @@ export function createContext<T>(

if (__DEV__) {
context._currentRenderer = null;
context._currentRenderer_secondary = null;
context._currentRenderer2 = null;
}

return context;
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ export type ReactContext<T> = {
_defaultValue: T,

_currentValue: T,
_currentValue_secondary: T,
_currentValue2: T,
_changedBits: number,
_changedBits_secondary: number,
_changedBits2: number,

// DEV only
_currentRenderer?: Object | null,
_currentRenderer_secondary?: Object | null,
_currentRenderer2?: Object | null,
};

export type ReactPortal = {
Expand Down

0 comments on commit 82255ac

Please sign in to comment.