Skip to content

Commit 064cc0c

Browse files
committed
Ensure strategy discovery is done before using
1 parent 3adad58 commit 064cc0c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/components/notifications/notification.edgedb.repository.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export class NotificationRepository
2828
super();
2929
}
3030

31-
onModuleInit() {
31+
async onModuleInit() {
32+
await this.service.ready.wait();
33+
3234
(this as any).hydrate = e.shape(e.Notification, (notification) => {
3335
return Object.assign(
3436
{

src/components/notifications/notification.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { DiscoveryService } from '@golevelup/nestjs-discovery';
22
import { forwardRef, Inject, Injectable, OnModuleInit } from '@nestjs/common';
33
import { mapEntries, Nil } from '@seedcompany/common';
4+
import Event from 'edgedb/dist/primitives/event.js';
45
import {
56
ID,
67
ResourceShape,
@@ -65,6 +66,7 @@ export class NotificationServiceImpl
6566
ResourceShape<Notification>,
6667
INotificationStrategy<Notification>
6768
>;
69+
readonly ready = new ((Event as any).default as typeof Event)();
6870

6971
constructor(private readonly discovery: DiscoveryService) {
7072
super();
@@ -107,5 +109,6 @@ export class NotificationServiceImpl
107109
}
108110
return [meta, instance];
109111
}).asMap;
112+
this.ready.set();
110113
}
111114
}

0 commit comments

Comments
 (0)