Match-id-97c0af573376bf091e9db7228d7cea81484ba94a

This commit is contained in:
* 2022-02-23 14:51:46 +08:00 committed by *
parent 46c4e406b1
commit b7183f1082
2 changed files with 10 additions and 9 deletions

View File

@ -103,7 +103,15 @@ function markLifeCycle(processing: VNode, nextProps: object, shouldUpdate: Boole
}
// 用于类组件
export function captureClassComponent(processing: VNode, clazz: any, nextProps: object): VNode | null {
export function captureRender(processing: VNode): VNode | null {
let clazz = processing.type;
let nextProps = processing.props;
if (processing.isLazyComponent) {
nextProps = mergeDefaultProps(clazz, nextProps);
if (processing.promiseResolve) { // 该函数被 lazy 组件使用,未加载的组件需要加载组件的真实内容
clazz = clazz._load(clazz._content);
}
}
const isOldCxtExist = isOldProvider(clazz);
cacheOldCtx(processing, isOldCxtExist);
@ -175,13 +183,6 @@ export function captureClassComponent(processing: VNode, clazz: any, nextProps:
}
}
export function captureRender(processing: VNode): VNode | null {
const clazz = processing.type;
const props = processing.props;
const nextProps = processing.isLazyComponent ? mergeDefaultProps(clazz, props) : props;
return captureClassComponent(processing, clazz, nextProps);
}
export function bubbleRender(processing: VNode) {
if (isOldProvider(processing.type)) {
resetOldCtx(processing);

View File

@ -10,7 +10,7 @@ import {
} from '../vnode/VNodeTags';
import { throwIfTrue } from '../utils/throwIfTrue';
import { captureFunctionComponent } from './FunctionComponent';
import { captureClassComponent } from './ClassComponent';
import { captureRender as captureClassComponent } from './ClassComponent';
import { captureMemoComponent } from './MemoComponent';
export function bubbleRender() { }