From b60fd019606dfd8692850544f717ed1755c83bc9 Mon Sep 17 00:00:00 2001 From: dswbx Date: Fri, 25 Apr 2025 22:36:19 -0700 Subject: [PATCH] fix sync events not awaited (#164) --- app/src/adapter/cloudflare/modes/fresh.ts | 2 +- app/src/data/entities/query/Repository.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/adapter/cloudflare/modes/fresh.ts b/app/src/adapter/cloudflare/modes/fresh.ts index d894065f..af085d6d 100644 --- a/app/src/adapter/cloudflare/modes/fresh.ts +++ b/app/src/adapter/cloudflare/modes/fresh.ts @@ -20,7 +20,7 @@ export async function getFresh( ...config, onBuilt: async (app) => { registerAsyncsExecutionContext(app, ctx.ctx); - config.onBuilt?.(app); + await config.onBuilt?.(app); }, }, ctx.env, diff --git a/app/src/data/entities/query/Repository.ts b/app/src/data/entities/query/Repository.ts index 35473ec3..1d2897a2 100644 --- a/app/src/data/entities/query/Repository.ts +++ b/app/src/data/entities/query/Repository.ts @@ -330,10 +330,10 @@ export class Repository> { - this.triggerFindBefore(this.entity, options); + await this.triggerFindBefore(this.entity, options); const { data, ...response } = await this.performQuery(qb); - this.triggerFindAfter(this.entity, options, data); + await this.triggerFindAfter(this.entity, options, data); return { ...response, data: data[0]! }; } @@ -434,16 +434,16 @@ export class Repository): Promise> { const { qb, options } = this.buildQuery(_options); - this.triggerFindBefore(this.entity, options); + await this.triggerFindBefore(this.entity, options); const res = await this.performQuery(qb); - this.triggerFindAfter(this.entity, options, res.data); + await this.triggerFindAfter(this.entity, options, res.data); return res as any; }