优化 form 重新渲染次数

This commit is contained in:
liaoxuezhi 2019-11-14 20:28:27 +08:00
parent 15c65cef4c
commit 055b0b2edb

View File

@ -728,19 +728,20 @@ export function HocStoreFactory(renderer: {
);
} else if (isObjectShallowModified(props.data, nextProps.data)) {
if (nextProps.store && nextProps.store.data === nextProps.data) {
const newData = createObject(
const diff = syncDataFromSuper(
store.data,
nextProps.store.data,
syncDataFromSuper(
store.data,
nextProps.store.data,
props.scope,
nextProps.dataUpdatedAt !== props.dataUpdatedAt,
store
)
props.scope,
nextProps.dataUpdatedAt !== props.dataUpdatedAt,
store
);
// todo fix: dialog 种数据从孩子 form 同步过来后,会走这个逻辑让 form 更新 data会导致里面的 __prev 丢失。
store.initData(newData);
if (Object.keys(diff).length) {
const newData = createObject(nextProps.store.data, diff);
// todo fix: dialog 种数据从孩子 form 同步过来后,会走这个逻辑让 form 更新 data会导致里面的 __prev 丢失。
store.initData(newData);
}
} else if (nextProps.data && (nextProps.data as any).__super) {
store.initData(extendObject(nextProps.data));
} else {