Match-id-7bdd5aa7851d0fb3ba0271c01879051dea1ccf20
This commit is contained in:
parent
77be7a916a
commit
9916cab3f7
|
@ -176,8 +176,13 @@ export function calcStartUpdateVNode(treeRoot: VNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toUpdateNodes.length === 1) {
|
if (toUpdateNodes.length === 1) {
|
||||||
|
const toUpdateNode = toUpdateNodes[0];
|
||||||
|
if (toUpdateNode.isCleared) {
|
||||||
|
return treeRoot;
|
||||||
|
} else {
|
||||||
return toUpdateNodes[0];
|
return toUpdateNodes[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 要计算的节点过多,直接返回根节点
|
// 要计算的节点过多,直接返回根节点
|
||||||
if (toUpdateNodes.length > 100) {
|
if (toUpdateNodes.length > 100) {
|
||||||
|
|
|
@ -39,6 +39,8 @@ export class VNode {
|
||||||
ref: RefType | ((handle: any) => void) | null = null; // 包裹一个函数,submit阶段使用,比如将外部useRef生成的对象赋值到ref上
|
ref: RefType | ((handle: any) => void) | null = null; // 包裹一个函数,submit阶段使用,比如将外部useRef生成的对象赋值到ref上
|
||||||
oldProps: any = null;
|
oldProps: any = null;
|
||||||
|
|
||||||
|
// 是否已经被从树上移除
|
||||||
|
isCleared = false;
|
||||||
changeList: any; // DOM的变更列表
|
changeList: any; // DOM的变更列表
|
||||||
effectList: any[] | null; // useEffect 的更新数组
|
effectList: any[] | null; // useEffect 的更新数组
|
||||||
updates: any[] | null; // TreeRoot和ClassComponent使用的更新数组
|
updates: any[] | null; // TreeRoot和ClassComponent使用的更新数组
|
||||||
|
|
|
@ -73,6 +73,7 @@ export function travelVNodeTree(
|
||||||
|
|
||||||
// 置空vNode
|
// 置空vNode
|
||||||
export function clearVNode(vNode: VNode) {
|
export function clearVNode(vNode: VNode) {
|
||||||
|
vNode.isCleared = true;
|
||||||
vNode.child = null;
|
vNode.child = null;
|
||||||
vNode.next = null;
|
vNode.next = null;
|
||||||
vNode.depContexts = null;
|
vNode.depContexts = null;
|
||||||
|
|
Loading…
Reference in New Issue