Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix _context property on returned ReactContext from createContext … #12501

Merged
merged 1 commit into from
Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-dom/src/server/ReactPartialRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ class ReactDOMServerRenderer {
pushProvider<T>(provider: ReactProvider<T>): void {
this.providerIndex += 1;
this.providerStack[this.providerIndex] = provider;
const context: ReactContext<any> = provider.type.context;
const context: ReactContext<any> = provider.type._context;
context._currentValue = provider.props.value;
}

Expand All @@ -689,7 +689,7 @@ class ReactDOMServerRenderer {
}
this.providerStack[this.providerIndex] = null;
this.providerIndex -= 1;
const context: ReactContext<any> = provider.type.context;
const context: ReactContext<any> = provider.type._context;
if (this.providerIndex < 0) {
context._currentValue = context._defaultValue;
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ export default function<T, P, I, TI, HI, PI, C, CC, CX, PL>(
renderExpirationTime,
) {
const providerType: ReactProviderType<any> = workInProgress.type;
const context: ReactContext<any> = providerType.context;
const context: ReactContext<any> = providerType._context;

const newProps = workInProgress.pendingProps;
const oldProps = workInProgress.memoizedProps;
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberNewContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function(stack: Stack) {
}

function pushProvider(providerFiber: Fiber): void {
const context: ReactContext<any> = providerFiber.type.context;
const context: ReactContext<any> = providerFiber.type._context;

push(changedBitsCursor, context._changedBits, providerFiber);
push(valueCursor, context._currentValue, providerFiber);
Expand Down Expand Up @@ -60,7 +60,7 @@ export default function(stack: Stack) {
pop(valueCursor, providerFiber);
pop(changedBitsCursor, providerFiber);

const context: ReactContext<any> = providerFiber.type.context;
const context: ReactContext<any> = providerFiber.type._context;
context._currentValue = currentValue;
context._changedBits = changedBits;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/ReactContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function createContext<T>(

context.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
context,
_context: context,
};
context.Consumer = context;

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type ReactProvider<T> = {

export type ReactProviderType<T> = {
$$typeof: Symbol | number,
context: ReactContext<T>,
_context: ReactContext<T>,
};

export type ReactConsumer<T> = {
Expand Down