Match-id-20580d03b043b1e2797e526aa4f39712457acac1
This commit is contained in:
parent
2b8df313ae
commit
44bdfa50d0
|
@ -1,8 +1,8 @@
|
||||||
import type { VNode } from '../Types';
|
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 { TYPE_COMMON_ELEMENT, TYPE_FRAGMENT, TYPE_PORTAL } from '../../external/JSXElementType';
|
||||||
import { DomText, DomPortal, Fragment, DomComponent } from '../vnode/VNodeTags';
|
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 {
|
import {
|
||||||
isSameType,
|
isSameType,
|
||||||
getIteratorFn,
|
getIteratorFn,
|
||||||
|
@ -270,7 +270,7 @@ function diffArrayNodesHandler(
|
||||||
theLastPosition = setVNodeAdditionFlag(newNode, theLastPosition, isComparing);
|
theLastPosition = setVNodeAdditionFlag(newNode, theLastPosition, isComparing);
|
||||||
newNode.eIndex = leftIdx;
|
newNode.eIndex = leftIdx;
|
||||||
newNode.cIndex = leftIdx;
|
newNode.cIndex = leftIdx;
|
||||||
updateVNodePath(newNode);
|
newNode.path = newNode.parent.path + newNode.cIndex;
|
||||||
appendNode(newNode);
|
appendNode(newNode);
|
||||||
oldNode = nextOldNode;
|
oldNode = nextOldNode;
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ function setVNodesCIndex(startChild: VNode, startIdx: number) {
|
||||||
|
|
||||||
while (node !== null) {
|
while (node !== null) {
|
||||||
node.cIndex = idx;
|
node.cIndex = idx;
|
||||||
updateVNodePath(node);
|
node.path = node.parent.path + node.cIndex;
|
||||||
node = node.next;
|
node = node.next;
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ function diffStringNodeHandler(
|
||||||
}
|
}
|
||||||
newTextNode.parent = parentNode;
|
newTextNode.parent = parentNode;
|
||||||
newTextNode.cIndex = 0;
|
newTextNode.cIndex = 0;
|
||||||
updateVNodePath(newTextNode);
|
newTextNode.path = newTextNode.parent.path + newTextNode.cIndex;
|
||||||
|
|
||||||
return newTextNode;
|
return newTextNode;
|
||||||
}
|
}
|
||||||
|
@ -597,7 +597,7 @@ function diffObjectNodeHandler(
|
||||||
|
|
||||||
resultNode.parent = parentNode;
|
resultNode.parent = parentNode;
|
||||||
resultNode.cIndex = 0;
|
resultNode.cIndex = 0;
|
||||||
updateVNodePath(resultNode);
|
resultNode.path = resultNode.parent.path + resultNode.cIndex;
|
||||||
if (startDelVNode) {
|
if (startDelVNode) {
|
||||||
deleteVNodes(parentNode, startDelVNode);
|
deleteVNodes(parentNode, startDelVNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type {VNode} from '../Types';
|
import type {VNode} from '../Types';
|
||||||
|
|
||||||
import {mergeDefaultProps} from './LazyComponent';
|
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 {shallowCompare} from '../utils/compare';
|
||||||
import {
|
import {
|
||||||
TYPE_FRAGMENT,
|
TYPE_FRAGMENT,
|
||||||
|
@ -29,7 +29,7 @@ export function captureMemoComponent(
|
||||||
}
|
}
|
||||||
newChild.parent = processing;
|
newChild.parent = processing;
|
||||||
newChild.ref = processing.ref;
|
newChild.ref = processing.ref;
|
||||||
updateVNodePath(newChild);
|
newChild.path = newChild.parent.path + newChild.cIndex;
|
||||||
processing.child = newChild;
|
processing.child = newChild;
|
||||||
|
|
||||||
return newChild;
|
return newChild;
|
||||||
|
@ -48,7 +48,7 @@ export function captureMemoComponent(
|
||||||
const newChild = updateVNode(firstChild, newProps);
|
const newChild = updateVNode(firstChild, newProps);
|
||||||
newChild.parent = processing;
|
newChild.parent = processing;
|
||||||
newChild.cIndex = 0;
|
newChild.cIndex = 0;
|
||||||
updateVNodePath(newChild);
|
newChild.path = newChild.parent.path + newChild.cIndex;
|
||||||
newChild.ref = processing.ref;
|
newChild.ref = processing.ref;
|
||||||
processing.child = newChild;
|
processing.child = newChild;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type {VNode, PromiseType} from '../Types';
|
import type {VNode, PromiseType} from '../Types';
|
||||||
|
|
||||||
import {FlagUtils, Interrupted} from '../vnode/VNodeFlags';
|
import {FlagUtils, Interrupted} from '../vnode/VNodeFlags';
|
||||||
import {onlyUpdateChildVNodes, updateVNode, updateVNodePath, createFragmentVNode} from '../vnode/VNodeCreator';
|
import {onlyUpdateChildVNodes, updateVNode, createFragmentVNode} from '../vnode/VNodeCreator';
|
||||||
import {
|
import {
|
||||||
ClassComponent,
|
ClassComponent,
|
||||||
IncompleteClassComponent,
|
IncompleteClassComponent,
|
||||||
|
@ -44,7 +44,7 @@ function createFallback(processing: VNode, fallbackChildren) {
|
||||||
fallbackFragment.parent = processing;
|
fallbackFragment.parent = processing;
|
||||||
fallbackFragment.eIndex = 1;
|
fallbackFragment.eIndex = 1;
|
||||||
fallbackFragment.cIndex = 1;
|
fallbackFragment.cIndex = 1;
|
||||||
updateVNodePath(fallbackFragment);
|
fallbackFragment.path = fallbackFragment.parent.path + fallbackFragment.cIndex;
|
||||||
processing.suspenseChildStatus = SuspenseChildStatus.ShowFallback;
|
processing.suspenseChildStatus = SuspenseChildStatus.ShowFallback;
|
||||||
|
|
||||||
return fallbackFragment;
|
return fallbackFragment;
|
||||||
|
@ -76,7 +76,7 @@ function createSuspenseChildren(processing: VNode, newChildren) {
|
||||||
|
|
||||||
childFragment.parent = processing;
|
childFragment.parent = processing;
|
||||||
childFragment.cIndex = 0;
|
childFragment.cIndex = 0;
|
||||||
updateVNodePath(childFragment);
|
childFragment.path = childFragment.parent.path + childFragment.cIndex;
|
||||||
processing.child = childFragment;
|
processing.child = childFragment;
|
||||||
processing.promiseResolve = false;
|
processing.promiseResolve = false;
|
||||||
return processing.child;
|
return processing.child;
|
||||||
|
|
|
@ -157,10 +157,6 @@ export function createVNode(tag: VNodeTag | string, ...secondArg) {
|
||||||
return vNode;
|
return vNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateVNodePath(vNode: VNode) {
|
|
||||||
vNode.path = vNode.parent.path + vNode.cIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createVNodeFromElement(element: JSXElement): VNode {
|
export function createVNodeFromElement(element: JSXElement): VNode {
|
||||||
const type = element.type;
|
const type = element.type;
|
||||||
const key = element.key;
|
const key = element.key;
|
||||||
|
@ -183,7 +179,7 @@ export function onlyUpdateChildVNodes(processing: VNode): VNode | null {
|
||||||
let child: VNode | null = processing.child;
|
let child: VNode | null = processing.child;
|
||||||
while (child !== null) {
|
while (child !== null) {
|
||||||
updateVNode(child, child.props);
|
updateVNode(child, child.props);
|
||||||
updateVNodePath(child);
|
child.path = child.parent.path + child.cIndex;
|
||||||
child = child.next;
|
child = child.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue