Browse Source

fix(core): Fix error when using channelId with getEntityOrThrow method

Michael Bromley 5 years ago
parent
commit
65c50d4270
1 changed files with 8 additions and 1 deletions
  1. 8 1
      packages/core/src/service/transaction/transactional-connection.ts

+ 8 - 1
packages/core/src/service/transaction/transactional-connection.ts

@@ -125,7 +125,14 @@ export class TransactionalConnection {
     ): Promise<T> {
         let entity: T | undefined;
         if (options.channelId != null) {
-            entity = await this.findOneInChannel(ctx, entityType, id, options.channelId, options);
+            const { channelId, ...optionsWithoutChannelId } = options;
+            entity = await this.findOneInChannel(
+                ctx,
+                entityType,
+                id,
+                options.channelId,
+                optionsWithoutChannelId,
+            );
         } else {
             entity = await this.getRepository(ctx, entityType).findOne(id, options as FindOneOptions);
         }