Skip to content

Commit

Permalink
fix(core): Do not error when removing deleted variant from channel
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jun 10, 2021
1 parent cafa04e commit e3e8828
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/service/services/channel.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ export class ChannelService {
entityType: Type<T>,
entityId: ID,
channelIds: ID[],
): Promise<T> {
const entity = await this.connection.getEntityOrThrow(ctx, entityType, entityId, {
): Promise<T | undefined> {
const entity = await this.connection.getRepository(ctx, entityType).findOne(entityId, {
relations: ['channels'],
});
if (!entity) {
return;
}
for (const id of channelIds) {
entity.channels = entity.channels.filter(c => !idsAreEqual(c.id, id));
}
Expand Down

0 comments on commit e3e8828

Please sign in to comment.