Match-id-0626165d0ffc57291804485ab490ae368677280d
This commit is contained in:
commit
50c670e6f1
|
@ -1,3 +1,6 @@
|
||||||
|
## 0.0.17 (2022-09-07)
|
||||||
|
- **core**: fix 不在树上的节点发起更新导致错误
|
||||||
|
|
||||||
## 0.0.16 (2022-09-07)
|
## 0.0.16 (2022-09-07)
|
||||||
- **core**: #56,#65 diff null 不能正确卸载组件
|
- **core**: #56,#65 diff null 不能正确卸载组件
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"horizon"
|
"horizon"
|
||||||
],
|
],
|
||||||
"version": "0.0.16",
|
"version": "0.0.17",
|
||||||
"homepage": "",
|
"homepage": "",
|
||||||
"bugs": "",
|
"bugs": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
|
|
@ -176,7 +176,12 @@ export function calcStartUpdateVNode(treeRoot: VNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toUpdateNodes.length === 1) {
|
if (toUpdateNodes.length === 1) {
|
||||||
return toUpdateNodes[0];
|
const toUpdateNode = toUpdateNodes[0];
|
||||||
|
if (toUpdateNode.isCleared) {
|
||||||
|
return treeRoot;
|
||||||
|
} else {
|
||||||
|
return toUpdateNodes[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 要计算的节点过多,直接返回根节点
|
// 要计算的节点过多,直接返回根节点
|
||||||
|
|
|
@ -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