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
+7 -2
View File
@@ -10,9 +10,14 @@ export class DesignerAPI extends BaseSQLDataSource {
constructor(options: DataSourceOptions, config) {
super(options, config);
this.loader = new DataLoader((keys: number[]) =>
this.getDesigners(undefined, keys),
this.loader = new DataLoader(async (keys: number[]) => {
const designersResult = await this.getDesigners(undefined, keys);
return keys.map(
(key) =>
designersResult.find((designerResult) => designerResult.id === key) ??
null,
);
});
}
async getDesignerById(id: number): Promise<Designer> {