diff --git a/src/factory.tsx b/src/factory.tsx index fef67a2f..d26c5dd8 100644 --- a/src/factory.tsx +++ b/src/factory.tsx @@ -728,20 +728,18 @@ export function HocStoreFactory(renderer: { ); } else if (isObjectShallowModified(props.data, nextProps.data)) { if (nextProps.store && nextProps.store.data === nextProps.data) { - const diff = syncDataFromSuper( - store.data, - nextProps.store.data, - props.scope, - nextProps.dataUpdatedAt !== props.dataUpdatedAt, - store + store.initData( + createObject( + nextProps.store.data, + syncDataFromSuper( + store.data, + nextProps.store.data, + props.scope, + nextProps.dataUpdatedAt !== props.dataUpdatedAt, + store + ) + ) ); - - 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 { diff --git a/src/renderers/Chart.tsx b/src/renderers/Chart.tsx index b8ae767a..6c754c54 100644 --- a/src/renderers/Chart.tsx +++ b/src/renderers/Chart.tsx @@ -34,7 +34,7 @@ export class Chart extends React.Component { echarts: any; unSensor: Function; pending?: object; - timer: number; + timer: NodeJS.Timeout; mounted: boolean; reloadCancel: Function; @@ -148,6 +148,9 @@ export class Chart extends React.Component { cancelExecutor: (executor: Function) => (this.reloadCancel = executor) }) .then(result => { + if (!result.ok) { + return env.notify('error', result.msg || '加载失败,请重试!'); + } delete this.reloadCancel; this.renderChart(result.data || {}); this.echarts && this.echarts.hideLoading();