Hotfix dataloader for designers (#141)

This commit is contained in:
Anders Gustafsson
2023-01-31 15:51:45 +01:00
committed by GitHub
parent 1720280840
commit 1193e2940d
+8 -3
View File
@@ -10,9 +10,14 @@ export class DesignerAPI extends BaseSQLDataSource {
constructor(options: DataSourceOptions, config) { constructor(options: DataSourceOptions, config) {
super(options, config); super(options, config);
this.loader = new DataLoader((keys: number[]) => this.loader = new DataLoader(async (keys: number[]) => {
this.getDesigners(undefined, keys), const designersResult = await this.getDesigners(undefined, keys);
); return keys.map(
(key) =>
designersResult.find((designerResult) => designerResult.id === key) ??
null,
);
});
} }
async getDesignerById(id: number): Promise<Designer> { async getDesignerById(id: number): Promise<Designer> {