Match-id-5cdfec2ac913c704d26e3fc47a3d41f0c6d6382f

This commit is contained in:
* 2022-02-17 10:52:12 +08:00 committed by *
parent 39674377c3
commit 290f2097c5
2 changed files with 11 additions and 15 deletions

View File

@ -25,17 +25,17 @@ export class VNode {
suspensePromises: any = null; // suspense组件的promise列表
changeList: any = null; // DOM的变更列表
effectList: any[] = []; // useEffect 的更新数组
effectList: any[] | null = []; // useEffect 的更新数组
updates: any[] | null = null; // TreeRoot和ClassComponent使用的更新数组
stateCallbacks: any[] = []; // 存放存在setState的第二个参数和HorizonDOM.render的第三个参数所在的node数组
stateCallbacks: any[] | null = []; // 存放存在setState的第二个参数和HorizonDOM.render的第三个参数所在的node数组
isForceUpdate: boolean = false; // 是否使用强制更新
state: any = null; // ClassComponent和TreeRoot的状态
hooks: Array<Hook<any, any>> = []; // 保存hook
hooks: Array<Hook<any, any>> | null = []; // 保存hook
suspenseChildStatus: string = ''; // Suspense的Children是否显示
depContexts: Array<ContextType<any>> = []; // FunctionComponent和ClassComponent对context的依赖列表
depContexts: Array<ContextType<any>> | null = []; // FunctionComponent和ClassComponent对context的依赖列表
isDepContextChange: boolean = false; // context是否变更
dirtyNodes: Array<VNode> = []; // 需要改动的节点数组
dirtyNodes: Array<VNode> | null = []; // 需要改动的节点数组
shouldUpdate: boolean = false;
childShouldUpdate: boolean = false;
outerDom: any;
@ -65,7 +65,7 @@ export class VNode {
clearChild: VNode | null = null;
// one tree相关属性
isCreated: boolean = true;
oldHooks: Array<Hook<any, any>> = []; // 保存上一次执行的hook
oldHooks: Array<Hook<any, any>> | null = []; // 保存上一次执行的hook
oldState: any = null;
oldRef: RefType | ((handle: any) => void) | null = null;
suspenseChildThrow = false;

View File

@ -79,28 +79,24 @@ export function travelVNodeTree(
export function clearVNode(vNode: VNode) {
vNode.child = null;
vNode.next = null;
vNode.depContexts = [];
vNode.dirtyNodes = [];
vNode.depContexts = null;
vNode.dirtyNodes = null;
vNode.state = null;
vNode.hooks = [];
vNode.suspenseChildStatus = '';
vNode.hooks = null;
vNode.props = null;
vNode.parent = null;
vNode.suspensePromises = null;
vNode.changeList = null;
vNode.effectList = [];
vNode.effectList = null;
vNode.updates = null;
vNode.realNode = null;
vNode.oldProps = null;
vNode.oldHooks = [];
vNode.oldHooks = null;
vNode.oldState = null;
vNode.oldRef = null;
vNode.suspenseChildThrow = false;
vNode.oldSuspenseChildStatus = '';
vNode.oldChild = null;
vNode.path = [];
vNode.toUpdateNodes = null;
vNode.belongClassVNode = null;