Skip to content

Commit

Permalink
fix(core): Do not publish CollectionModificationEvent if no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jul 27, 2023
1 parent 7c9d110 commit 75f6dec
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/service/services/collection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import { moveToIndex } from '../helpers/utils/move-to-index';

import { AssetService } from './asset.service';
import { ChannelService } from './channel.service';
import { FacetValueService } from './facet-value.service';
import { RoleService } from './role.service';

export type ApplyCollectionFiltersJobData = {
Expand All @@ -72,7 +71,6 @@ export class CollectionService implements OnModuleInit {
private connection: TransactionalConnection,
private channelService: ChannelService,
private assetService: AssetService,
private facetValueService: FacetValueService,
private listQueryBuilder: ListQueryBuilder,
private translatableSaver: TranslatableSaver,
private eventBus: EventBus,
Expand Down Expand Up @@ -142,9 +140,11 @@ export class CollectionService implements OnModuleInit {
continue;
}
job.setProgress(Math.ceil((completed / job.data.collectionIds.length) * 100));
this.eventBus.publish(
new CollectionModificationEvent(ctx, collection, affectedVariantIds),
);
if (affectedVariantIds.length) {
this.eventBus.publish(
new CollectionModificationEvent(ctx, collection, affectedVariantIds),
);
}
}
}
},
Expand Down

0 comments on commit 75f6dec

Please sign in to comment.