Skip to content

Commit

Permalink
fix(data-source): 执行时机函数需要await
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen authored and jia000 committed Dec 9, 2024
1 parent 12230c2 commit 5caae4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/data-source/src/DataSourceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ class DataSourceManager extends EventEmitter {
for (const method of ds.methods) {
if (typeof method.content !== 'function') return;
if (method.timing === 'beforeInit') {
method.content({ params: {}, dataSource: ds, app: this.app });
await method.content({ params: {}, dataSource: ds, app: this.app });
}
}

await ds.init();

ds.methods.forEach((method) => {
for (const method of ds.methods) {
if (typeof method.content !== 'function') return;
if (method.timing === 'afterInit') {
method.content({ params: {}, dataSource: ds, app: this.app });
await method.content({ params: {}, dataSource: ds, app: this.app });
}
});
}
}

public get(id: string) {
Expand Down

0 comments on commit 5caae4e

Please sign in to comment.