Match-id-2d3ad46152443e0e465ba7f54dc734e3cf1694af
This commit is contained in:
parent
8c1b44cde9
commit
712b9b42c1
|
@ -17,14 +17,14 @@ let ctxNamespace = '';
|
|||
export function setNamespaceCtx(vNode: VNode, dom?: Container) {
|
||||
const nextContext = getNSCtx(ctxNamespace, vNode.type, dom);
|
||||
|
||||
vNode.contexts = ctxNamespace;
|
||||
vNode.context = ctxNamespace;
|
||||
|
||||
ctxNamespace = nextContext;
|
||||
}
|
||||
|
||||
// bubble阶段恢复
|
||||
export function resetNamespaceCtx(vNode: VNode) {
|
||||
ctxNamespace = vNode.contexts;
|
||||
ctxNamespace = vNode.context;
|
||||
}
|
||||
|
||||
export function getNamespaceCtx(): string {
|
||||
|
@ -34,7 +34,7 @@ export function getNamespaceCtx(): string {
|
|||
export function setContext<T>(providerVNode: VNode, nextValue: T) {
|
||||
const context: ContextType<T> = providerVNode.type._context;
|
||||
|
||||
providerVNode.contexts = context.value;
|
||||
providerVNode.context = context.value;
|
||||
|
||||
context.value = nextValue;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ export function setContext<T>(providerVNode: VNode, nextValue: T) {
|
|||
export function resetContext(providerVNode: VNode) {
|
||||
const context: ContextType<any> = providerVNode.type._context;
|
||||
|
||||
context.value = providerVNode.contexts;
|
||||
context.value = providerVNode.context;
|
||||
}
|
||||
|
||||
// 在局部更新时,恢复父节点的context
|
||||
|
@ -51,7 +51,7 @@ export function recoverParentContext(vNode: VNode) {
|
|||
|
||||
while (parent !== null) {
|
||||
if (parent.tag === ContextProvider) {
|
||||
parent.contexts = parent.props.value;
|
||||
parent.context = parent.props.value;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ export class VNode {
|
|||
task: any;
|
||||
|
||||
// 使用这个变量来记录修改前的值,用于恢复。
|
||||
contexts: any;
|
||||
context: any;
|
||||
// 因为LazyComponent会修改tag和type属性,为了能识别,增加一个属性
|
||||
isLazyComponent: boolean;
|
||||
|
||||
|
@ -93,7 +93,7 @@ export class VNode {
|
|||
this.stateCallbacks = null;
|
||||
this.state = null;
|
||||
this.oldState = null;
|
||||
this.contexts = null;
|
||||
this.context = null;
|
||||
break;
|
||||
case FunctionComponent:
|
||||
this.realNode = null;
|
||||
|
@ -112,16 +112,16 @@ export class VNode {
|
|||
this.depContexts = null;
|
||||
this.isDepContextChange = false;
|
||||
this.oldState = null;
|
||||
this.contexts = null;
|
||||
this.context = null;
|
||||
break;
|
||||
case DomPortal:
|
||||
this.realNode = null;
|
||||
this.contexts = null;
|
||||
this.context = null;
|
||||
break;
|
||||
case DomComponent:
|
||||
this.realNode = null;
|
||||
this.changeList = null;
|
||||
this.contexts = null;
|
||||
this.context = null;
|
||||
break;
|
||||
case DomText:
|
||||
this.realNode = null;
|
||||
|
@ -137,7 +137,7 @@ export class VNode {
|
|||
};
|
||||
break;
|
||||
case ContextProvider:
|
||||
this.contexts = null;
|
||||
this.context = null;
|
||||
break;
|
||||
case MemoComponent:
|
||||
this.effectList = null;
|
||||
|
|
Loading…
Reference in New Issue