Match-id-20580d03b043b1e2797e526aa4f39712457acac1

This commit is contained in:
* 2022-02-18 18:07:32 +08:00 committed by *
parent 2b8df313ae
commit 44bdfa50d0
4 changed files with 13 additions and 17 deletions

View File

@ -1,8 +1,8 @@
import type { VNode } from '../Types';
import { FlagUtils, DirectAddition } from '../vnode/VNodeFlags';
import { FlagUtils } from '../vnode/VNodeFlags';
import { TYPE_COMMON_ELEMENT, TYPE_FRAGMENT, TYPE_PORTAL } from '../../external/JSXElementType';
import { DomText, DomPortal, Fragment, DomComponent } from '../vnode/VNodeTags';
import {updateVNode, createVNodeFromElement, updateVNodePath, createFragmentVNode, createPortalVNode, createDomTextVNode} from '../vnode/VNodeCreator';
import {updateVNode, createVNodeFromElement, createFragmentVNode, createPortalVNode, createDomTextVNode} from '../vnode/VNodeCreator';
import {
isSameType,
getIteratorFn,
@ -270,7 +270,7 @@ function diffArrayNodesHandler(
theLastPosition = setVNodeAdditionFlag(newNode, theLastPosition, isComparing);
newNode.eIndex = leftIdx;
newNode.cIndex = leftIdx;
updateVNodePath(newNode);
newNode.path = newNode.parent.path + newNode.cIndex;
appendNode(newNode);
oldNode = nextOldNode;
}
@ -468,7 +468,7 @@ function setVNodesCIndex(startChild: VNode, startIdx: number) {
while (node !== null) {
node.cIndex = idx;
updateVNodePath(node);
node.path = node.parent.path + node.cIndex;
node = node.next;
idx++;
}
@ -519,7 +519,7 @@ function diffStringNodeHandler(
}
newTextNode.parent = parentNode;
newTextNode.cIndex = 0;
updateVNodePath(newTextNode);
newTextNode.path = newTextNode.parent.path + newTextNode.cIndex;
return newTextNode;
}
@ -597,7 +597,7 @@ function diffObjectNodeHandler(
resultNode.parent = parentNode;
resultNode.cIndex = 0;
updateVNodePath(resultNode);
resultNode.path = resultNode.parent.path + resultNode.cIndex;
if (startDelVNode) {
deleteVNodes(parentNode, startDelVNode);
}

View File

@ -1,7 +1,7 @@
import type {VNode} from '../Types';
import {mergeDefaultProps} from './LazyComponent';
import {updateVNode, onlyUpdateChildVNodes, updateVNodePath, createFragmentVNode, createUndeterminedVNode} from '../vnode/VNodeCreator';
import {updateVNode, onlyUpdateChildVNodes, createFragmentVNode, createUndeterminedVNode} from '../vnode/VNodeCreator';
import {shallowCompare} from '../utils/compare';
import {
TYPE_FRAGMENT,
@ -29,7 +29,7 @@ export function captureMemoComponent(
}
newChild.parent = processing;
newChild.ref = processing.ref;
updateVNodePath(newChild);
newChild.path = newChild.parent.path + newChild.cIndex;
processing.child = newChild;
return newChild;
@ -48,7 +48,7 @@ export function captureMemoComponent(
const newChild = updateVNode(firstChild, newProps);
newChild.parent = processing;
newChild.cIndex = 0;
updateVNodePath(newChild);
newChild.path = newChild.parent.path + newChild.cIndex;
newChild.ref = processing.ref;
processing.child = newChild;

View File

@ -1,7 +1,7 @@
import type {VNode, PromiseType} from '../Types';
import {FlagUtils, Interrupted} from '../vnode/VNodeFlags';
import {onlyUpdateChildVNodes, updateVNode, updateVNodePath, createFragmentVNode} from '../vnode/VNodeCreator';
import {onlyUpdateChildVNodes, updateVNode, createFragmentVNode} from '../vnode/VNodeCreator';
import {
ClassComponent,
IncompleteClassComponent,
@ -44,7 +44,7 @@ function createFallback(processing: VNode, fallbackChildren) {
fallbackFragment.parent = processing;
fallbackFragment.eIndex = 1;
fallbackFragment.cIndex = 1;
updateVNodePath(fallbackFragment);
fallbackFragment.path = fallbackFragment.parent.path + fallbackFragment.cIndex;
processing.suspenseChildStatus = SuspenseChildStatus.ShowFallback;
return fallbackFragment;
@ -76,7 +76,7 @@ function createSuspenseChildren(processing: VNode, newChildren) {
childFragment.parent = processing;
childFragment.cIndex = 0;
updateVNodePath(childFragment);
childFragment.path = childFragment.parent.path + childFragment.cIndex;
processing.child = childFragment;
processing.promiseResolve = false;
return processing.child;

View File

@ -157,10 +157,6 @@ export function createVNode(tag: VNodeTag | string, ...secondArg) {
return vNode;
}
export function updateVNodePath(vNode: VNode) {
vNode.path = vNode.parent.path + vNode.cIndex;
}
export function createVNodeFromElement(element: JSXElement): VNode {
const type = element.type;
const key = element.key;
@ -183,7 +179,7 @@ export function onlyUpdateChildVNodes(processing: VNode): VNode | null {
let child: VNode | null = processing.child;
while (child !== null) {
updateVNode(child, child.props);
updateVNodePath(child);
child.path = child.parent.path + child.cIndex;
child = child.next;
}
}