fix(core): 异步加载数据源时,数据源事件配置失效

This commit is contained in:
roymondchen 2025-09-16 19:34:15 +08:00
parent f5cb19dfa4
commit 1031595a97
2 changed files with 10 additions and 3 deletions

View File

@ -167,8 +167,13 @@ class App extends EventEmitter {
this.setPage(pageId);
if (this.dataSourceManager) {
const dataSourceList = Array.from(this.dataSourceManager.dataSourceMap.values());
this.eventHelper?.bindDataSourceEvents(dataSourceList);
if (this.dataSourceManager.isAllDataSourceRegistered()) {
this.eventHelper?.bindDataSourceEvents();
} else {
this.dataSourceManager.once('registered-all', () => {
this.eventHelper?.bindDataSourceEvents();
});
}
}
}

View File

@ -121,7 +121,9 @@ export default class EventHelper extends EventEmitter {
this.nodeEventList.clear();
}
public bindDataSourceEvents(dataSourceList: DataSource[]) {
public bindDataSourceEvents() {
const dataSourceList = Array.from(this.app.dataSourceManager?.dataSourceMap.values() || []);
this.removeDataSourceEvents(dataSourceList);
dataSourceList.forEach((dataSource) => {