Match-id-4b079f1ecf2a5cb384aed61f56d8e4485b301702
This commit is contained in:
parent
e8cb6e66d4
commit
630cc2ca26
|
@ -1,3 +1,6 @@
|
|||
## 0.0.49 (2023-05-19)
|
||||
- **core**: 解决当组件被销毁,业务若异步(定时器)调用setState修改状态,可能出现路径错误问题。
|
||||
|
||||
## 0.0.48 (2023-05-18)
|
||||
- **core**: 解决style中属性WebkitLineClamp值被转换成字符串问题
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"keywords": [
|
||||
"horizon"
|
||||
],
|
||||
"version": "0.0.48",
|
||||
"version": "0.0.49",
|
||||
"homepage": "",
|
||||
"bugs": "",
|
||||
"main": "index.js",
|
||||
|
|
|
@ -141,7 +141,7 @@ export function newTextDom(text: string, processing: VNode): Text {
|
|||
return textNode;
|
||||
}
|
||||
|
||||
// 提交vNode的类型为Component或者Text的更新
|
||||
// 提交vNode的类型为DomComponent或者DomText的更新
|
||||
export function submitDomUpdate(tag: string, vNode: VNode) {
|
||||
const newProps = vNode.props;
|
||||
const element: Element | null = vNode.realNode;
|
||||
|
|
|
@ -98,7 +98,7 @@ export function validateProps(type, props) {
|
|||
return;
|
||||
}
|
||||
|
||||
// 非内置的变迁
|
||||
// 非内置的元素
|
||||
if (!isNativeElement(type, props)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -179,6 +179,11 @@ function isEqualByIndex(idx: number, pathArrays: string[][]) {
|
|||
function getChildByIndex(vNode: VNode, idx: number) {
|
||||
let node = vNode.child;
|
||||
for (let i = 0; i < idx; i++) {
|
||||
// 场景:当组件被销毁,业务若异步(定时器)调用setState修改状态,可能出现路径错误,此处进行保护。
|
||||
if (node == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
node = node.next;
|
||||
}
|
||||
return node;
|
||||
|
|
|
@ -33,7 +33,7 @@ class Component<P, S, C> {
|
|||
|
||||
setState(state: S, callback?: Callback) {
|
||||
if (isDev) {
|
||||
console.error('Cant not call `this.setState` in the constructor of class component, it will do nothing');
|
||||
console.error('Can not call `this.setState` in the constructor of class component, it will do nothing');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue