fix: 合并检查api的if逻辑

This commit is contained in:
fujianchao 2024-11-04 19:15:31 +08:00 committed by lmaomaoz
parent 61f9fda324
commit 82efeba01d

View File

@ -240,13 +240,10 @@ export class TimelineRenderer extends React.Component<TimelineProps> {
if (this.remoteRef && source !== prevProps.source) {
// 如果是变量则同步配置。如果为api则重新加载配置
(isPureVariable(source) && this.remoteRef.syncConfig()) ||
(isEffectiveApi(source, data) &&
(source as ApiObject).autoRefresh !== false &&
this.remoteRef.loadConfig());
// 如果source为空则清空配置
if (!source || (typeof source === 'object' && !source.url)) {
this.remoteRef.setConfig(undefined);
}
(isEffectiveApi(source, data)
? (source as ApiObject).autoRefresh !== false &&
this.remoteRef.loadConfig()
: this.remoteRef.setConfig(undefined));
}
}