mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 20:39:07 +08:00
fix: 调整 chart 初始加载时机 & dialog drawer 可能存在数据不同步的情况修复
This commit is contained in:
parent
6322fee073
commit
cce4069569
@ -177,19 +177,20 @@ export class Chart extends React.Component<ChartProps> {
|
||||
this.refFn = this.refFn.bind(this);
|
||||
this.reload = this.reload.bind(this);
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
|
||||
const {config, api, data, initFetch, source} = props;
|
||||
|
||||
this.mounted = true;
|
||||
|
||||
props.config && this.renderChart(props.config);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {api, data, initFetch, source} = this.props;
|
||||
|
||||
if (source && isPureVariable(source)) {
|
||||
const ret = resolveVariableAndFilter(source, data, '| raw');
|
||||
ret && this.renderChart(ret);
|
||||
} else if (api && initFetch !== false) {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
config && this.renderChart(config);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: ChartProps) {
|
||||
|
@ -604,7 +604,9 @@ export default class Dialog extends React.Component<DialogProps> {
|
||||
isolateScope: true,
|
||||
shouldSyncSuperStore: (store: IServiceStore, props: any, prevProps: any) =>
|
||||
(store.dialogOpen || props.show) &&
|
||||
isObjectShallowModified(prevProps.data, props.data)
|
||||
(props.show !== prevProps.show ||
|
||||
isObjectShallowModified(prevProps.data, props.data) ||
|
||||
isObjectShallowModified(prevProps.data.__super, props.data.__super))
|
||||
})
|
||||
export class DialogRenderer extends Dialog {
|
||||
static contextType = ScopedContext;
|
||||
|
@ -656,7 +656,9 @@ export default class Drawer extends React.Component<DrawerProps> {
|
||||
isolateScope: true,
|
||||
shouldSyncSuperStore: (store: IServiceStore, props: any, prevProps: any) =>
|
||||
(store.drawerOpen || props.show) &&
|
||||
isObjectShallowModified(prevProps.data, props.data)
|
||||
(props.show !== prevProps.show ||
|
||||
isObjectShallowModified(prevProps.data, props.data) ||
|
||||
isObjectShallowModified(prevProps.data.__super, props.data.__super))
|
||||
})
|
||||
export class DrawerRenderer extends Drawer {
|
||||
static contextType = ScopedContext;
|
||||
|
Loading…
Reference in New Issue
Block a user