Match-id-b6cac53463810555e2269155146dbe8d5ce72177
This commit is contained in:
parent
da571cecd3
commit
0be64ac289
|
@ -471,7 +471,7 @@ function diffIteratorNodesHandler(
|
|||
parentNode: VNode,
|
||||
firstChild: VNode | null,
|
||||
newChildrenIterable: Iterable<any>,
|
||||
isComparing: boolean = true
|
||||
isComparing: boolean
|
||||
): VNode | null {
|
||||
const iteratorFn = getIteratorFn(newChildrenIterable);
|
||||
const iteratorObj = iteratorFn.call(newChildrenIterable);
|
||||
|
@ -604,7 +604,7 @@ export function createChildrenByDiff(
|
|||
parentNode: VNode,
|
||||
firstChild: VNode | null,
|
||||
newChild: any,
|
||||
isComparing: boolean = true
|
||||
isComparing: boolean
|
||||
): VNode | null {
|
||||
const isFragment = isNoKeyFragment(newChild);
|
||||
newChild = isFragment ? newChild.props.children : newChild;
|
||||
|
|
|
@ -56,7 +56,7 @@ function handleContextChange(processing: VNode, context: ContextType<any>): void
|
|||
}, node =>
|
||||
// 如果这是匹配的provider,则不要更深入地扫描
|
||||
node.tag === ContextProvider && node.type === processing.type
|
||||
, processing);
|
||||
, processing, null);
|
||||
|
||||
// 找到了依赖context的子节点,触发一次更新
|
||||
if (isMatch) {
|
||||
|
|
|
@ -88,7 +88,7 @@ export function bubbleRender(processing: VNode) {
|
|||
}, node =>
|
||||
// 已经append到父节点,或者是DomPortal都不需要处理child了
|
||||
node.tag === DomComponent || node.tag === DomText || node.tag === DomPortal
|
||||
, processing);
|
||||
, processing, null);
|
||||
}
|
||||
|
||||
processing.realNode = dom;
|
||||
|
|
|
@ -17,7 +17,7 @@ function capturePortalComponent(processing: VNode) {
|
|||
|
||||
const newElements = processing.props;
|
||||
if (processing.isCreated) {
|
||||
processing.child = createChildrenByDiff(processing, null, newElements);
|
||||
processing.child = createChildrenByDiff(processing, null, newElements, true);
|
||||
} else {
|
||||
processing.child = createVNodeChildren(processing, newElements);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ function hideOrUnhideAllChildren(vNode, isHidden) {
|
|||
unHideDom(node.tag, instance, node.props);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, null, vNode, null);
|
||||
}
|
||||
|
||||
function attachRef(vNode: VNode) {
|
||||
|
@ -216,7 +216,7 @@ function unmountNestedVNodes(vNode: VNode): void {
|
|||
}, node =>
|
||||
// 如果是DomPortal,不需要遍历child
|
||||
node.tag === DomPortal
|
||||
);
|
||||
, vNode, null);
|
||||
}
|
||||
|
||||
function submitAddition(vNode: VNode): void {
|
||||
|
@ -314,7 +314,7 @@ function unmountDomComponents(vNode: VNode): void {
|
|||
}
|
||||
}, node =>
|
||||
// 如果是dom不用再遍历child
|
||||
node.tag === DomComponent || node.tag === DomText, null, (node) => {
|
||||
node.tag === DomComponent || node.tag === DomText, vNode, (node) => {
|
||||
if (node.tag === DomPortal) {
|
||||
// 当离开portal,需要重新设置parent
|
||||
currentParentIsValid = false;
|
||||
|
|
|
@ -27,11 +27,11 @@ export function travelChildren(beginVNode: VNode, handleVNode: Function, isFinis
|
|||
export function travelVNodeTree(
|
||||
beginVNode: VNode,
|
||||
handleVNode: Function,
|
||||
childFilter: Function = () => false, // 返回true不处理child
|
||||
finishVNode?: VNode, // 结束遍历节点,有时候和beginVNode不相同
|
||||
handleWhenToParent?: Function
|
||||
childFilter: ((node: VNode) => boolean) | null, // 返回true不处理child
|
||||
finishVNode: VNode, // 结束遍历节点,有时候和beginVNode不相同
|
||||
handleWhenToParent: Function | null
|
||||
): VNode | null {
|
||||
const overVNode = finishVNode || beginVNode;
|
||||
const filter = childFilter === null;
|
||||
let node = beginVNode;
|
||||
|
||||
while (true) {
|
||||
|
@ -43,20 +43,20 @@ export function travelVNodeTree(
|
|||
|
||||
// 找子节点
|
||||
const childVNode = node.child;
|
||||
if (childVNode !== null && !childFilter(node)) {
|
||||
if (childVNode !== null && (filter || !childFilter(node))) {
|
||||
childVNode.parent = node;
|
||||
node = childVNode;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 回到开始节点
|
||||
if (node === overVNode) {
|
||||
if (node === finishVNode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 找兄弟,没有就往上再找兄弟
|
||||
while (node.next === null) {
|
||||
if (node.parent === null || node.parent === overVNode) {
|
||||
if (node.parent === null || node.parent === finishVNode) {
|
||||
return null;
|
||||
}
|
||||
node = node.parent;
|
||||
|
@ -119,7 +119,7 @@ export function findDomVNode(vNode: VNode): VNode | null {
|
|||
return node;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}, null, vNode, null);
|
||||
}
|
||||
|
||||
export function findDOMByClassInst(inst) {
|
||||
|
|
Loading…
Reference in New Issue